staging: r8188eu: Replace zero-length array with flexible-array member
One-element and zero-length arrays are deprecated and should be replaced with flexible-array members[1]. Replace zero-length array with flexible-array member and make use of the struct_size() helper in kmalloc(). [1] https://www.kernel.org/doc/html/v5.10/process/deprecated.html#zero-length-and-one-element-arrays Link: https://github.com/KSPP/linux/issues/78 Link: https://github.com/KSPP/linux/issues/160 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20210929193658.GA339070@embeddedor Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
403aa62da3
commit
c08976563d
@ -289,7 +289,7 @@ struct rtw_cbuf {
|
||||
u32 write;
|
||||
u32 read;
|
||||
u32 size;
|
||||
void *bufs[0];
|
||||
void *bufs[];
|
||||
};
|
||||
|
||||
bool rtw_cbuf_empty(struct rtw_cbuf *cbuf);
|
||||
|
@ -262,7 +262,7 @@ struct rtw_cbuf *rtw_cbuf_alloc(u32 size)
|
||||
{
|
||||
struct rtw_cbuf *cbuf;
|
||||
|
||||
cbuf = kmalloc(sizeof(*cbuf) + sizeof(void *) * size, GFP_KERNEL);
|
||||
cbuf = kmalloc(struct_size(cbuf, bufs, size), GFP_KERNEL);
|
||||
|
||||
if (cbuf) {
|
||||
cbuf->write = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user