[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20241218074552.3271542-1-zhangkunbo@huawei.com>
Date: Wed, 18 Dec 2024 07:45:52 +0000
From: Zhang Kunbo <zhangkunbo@...wei.com>
To: <nbd@....name>, <lorenzo@...nel.org>, <ryder.lee@...iatek.com>,
<shayne.chen@...iatek.com>, <sean.wang@...iatek.com>, <kvalo@...nel.org>,
<matthias.bgg@...il.com>, <angelogioacchino.delregno@...labora.com>,
<deren.wu@...iatek.com>, <mingyen.hsieh@...iatek.com>
CC: <linux-wireless@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-mediatek@...ts.infradead.org>,
<chris.zjh@...wei.com>, <liaochang1@...wei.com>
Subject: [PATCH -next] wifi: mt76: mt7925:: replace zero-length array with flexible-array member
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1],
introduced in C99:
struct foo {
int stuff;
struct boo array[];
};
By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last, which is beneficial
to cultivate a high-quality code.[2]
This issue was found with the help of Coccinelle.
[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")
Signed-off-by: Zhang Kunbo <zhangkunbo@...wei.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 748ea6adbc6b..956d62062730 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -388,7 +388,7 @@ mt7925_mcu_tx_done_event(struct mt792x_dev *dev, struct sk_buff *skb)
struct mt7925_mcu_txs_event {
u8 ver;
u8 rsv[3];
- u8 data[0];
+ u8 data[];
} __packed * txs;
struct tlv *tlv;
u32 tlv_len;
--
2.34.1
Powered by blists - more mailing lists