Skip to contentSkip to conversation

carl9170: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

PATCH In review Gustavo A. R. Silva 3 participants 3 messages Sep 26, 2022 – Sep 30, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 carl9170: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations in anonymous union with the new DECLARE_FLEX_ARRAY() helper macro.

This helper allows for flexible-array members in unions.

---
 drivers/net/wireless/ath/carl9170/wlan.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/carl9170/wlan.h +1 -1
index 0a4e42e806b9..ded2c6d0a759 100644
@@ -271,7 +271,7 @@ struct ar9170_tx_frame {
 
 	union {
 		struct ieee80211_hdr i3e;
-		u8 payload[0];
+		DECLARE_FLEX_ARRAY(u8, payload);
 	} data;
 } __packed;
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Gustavo A. R. Silva

Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations in anonymous union with the new DECLARE_FLEX_ARRAY() helper macro.

This helper allows for flexible-array members in unions.

Signature · 1 line
Kees Cook
#2 lore raw
In reply to Gustavo A. R. Silva
Quoted 5 lines · Gustavo A. R. Silva

Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations in anonymous union with the new DECLARE_FLEX_ARRAY() helper macro.

Quoted 8 lines

This helper allows for flexible-array members in unions.

Patch applied to ath-next branch of ath.git, thanks.

9ec6e20776ab carl9170: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/YzIdWc8QSdZFHBYg@work/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches