public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] wifi: mt76: mt7925:: replace zero-length array with flexible-array member
@ 2024-12-18  7:45 Zhang Kunbo
  2024-12-25  8:53 ` zhangkunbo
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Kunbo @ 2024-12-18  7:45 UTC (permalink / raw)
  To: nbd, lorenzo, ryder.lee, shayne.chen, sean.wang, kvalo,
	matthias.bgg, angelogioacchino.delregno, deren.wu, mingyen.hsieh
  Cc: linux-wireless, linux-kernel, linux-arm-kernel, linux-mediatek,
	chris.zjh, liaochang1

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@huawei.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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] wifi: mt76: mt7925:: replace zero-length array with flexible-array member
  2024-12-18  7:45 [PATCH -next] wifi: mt76: mt7925:: replace zero-length array with flexible-array member Zhang Kunbo
@ 2024-12-25  8:53 ` zhangkunbo
  2024-12-26  1:21   ` Ping-Ke Shih
  0 siblings, 1 reply; 3+ messages in thread
From: zhangkunbo @ 2024-12-25  8:53 UTC (permalink / raw)
  To: zhangkunbo
  Cc: angelogioacchino.delregno, chris.zjh, deren.wu, kvalo, liaochang1,
	linux-arm-kernel, linux-kernel, linux-mediatek, linux-wireless,
	lorenzo, matthias.bgg, mingyen.hsieh, nbd, ryder.lee, sean.wang,
	shayne.chen

ping gently.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH -next] wifi: mt76: mt7925:: replace zero-length array with flexible-array member
  2024-12-25  8:53 ` zhangkunbo
@ 2024-12-26  1:21   ` Ping-Ke Shih
  0 siblings, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2024-12-26  1:21 UTC (permalink / raw)
  To: zhangkunbo
  Cc: angelogioacchino.delregno@collabora.com, chris.zjh@huawei.com,
	deren.wu@mediatek.com, kvalo@kernel.org, liaochang1@huawei.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-wireless@vger.kernel.org, lorenzo@kernel.org,
	matthias.bgg@gmail.com, mingyen.hsieh@mediatek.com, nbd@nbd.name,
	ryder.lee@mediatek.com, sean.wang@mediatek.com,
	shayne.chen@mediatek.com


zhangkunbo <zhangkunbo@huawei.com> wrote:
> 
> ping gently.
> 

Have you checked patchwork?
As patch state is new [1], I think maintainers who have new year holiday
don't miss it. 

[1] https://patchwork.kernel.org/project/linux-wireless/patch/20241218074552.3271542-1-zhangkunbo@huawei.com/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-26  1:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-18  7:45 [PATCH -next] wifi: mt76: mt7925:: replace zero-length array with flexible-array member Zhang Kunbo
2024-12-25  8:53 ` zhangkunbo
2024-12-26  1:21   ` Ping-Ke Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox