summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8723bs
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavoars@kernel.org>2021-09-29 14:41:18 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-10-05 12:28:06 +0200
commit0d197f2088e6c116d33ab9af66daac8be45f1a4b (patch)
tree567fa663c5a4310cadbde8ce10d22c17645705f9 /drivers/staging/rtl8723bs
parent42bdb41d2ef84311b6699432273be6565001128b (diff)
staging: rtl8723bs: 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. [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/20210929194118.GA340431@embeddedor Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8723bs')
-rw-r--r--drivers/staging/rtl8723bs/include/osdep_service.h2
-rw-r--r--drivers/staging/rtl8723bs/os_dep/osdep_service.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/rtl8723bs/include/osdep_service.h b/drivers/staging/rtl8723bs/include/osdep_service.h
index bde415db4114..cf96b5f7a776 100644
--- a/drivers/staging/rtl8723bs/include/osdep_service.h
+++ b/drivers/staging/rtl8723bs/include/osdep_service.h
@@ -113,7 +113,7 @@ struct rtw_cbuf {
u32 write;
u32 read;
u32 size;
- void *bufs[0];
+ void *bufs[];
};
bool rtw_cbuf_full(struct rtw_cbuf *cbuf);
diff --git a/drivers/staging/rtl8723bs/os_dep/osdep_service.c b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
index 2d630ecef08b..d6bddf7b08e8 100644
--- a/drivers/staging/rtl8723bs/os_dep/osdep_service.c
+++ b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
@@ -274,7 +274,7 @@ struct rtw_cbuf *rtw_cbuf_alloc(u32 size)
{
struct rtw_cbuf *cbuf;
- cbuf = rtw_malloc(sizeof(*cbuf) + sizeof(void *) * size);
+ cbuf = rtw_malloc(struct_size(cbuf, bufs, size));
if (cbuf) {
cbuf->write = cbuf->read = 0;