Skip to contentSkip to conversation

ALSA: hda/hdmi: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

PATCH Applied Gustavo A. R. Silva 3 participants 3 messages Aug 29, 2022 – Aug 30, 2022 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda/hdmi: 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 array declaration in union audio_infoframe with the new DECLARE_FLEX_ARRAY() helper macro.

This helper allows for a flexible-array member in a union.

---
 sound/pci/hda/patch_hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_hdmi.c +1 -1
index 6c209cd26c0c..2191d445d74e 100644
@@ -229,7 +229,7 @@ struct dp_audio_infoframe {
 union audio_infoframe {
 	struct hdmi_audio_infoframe hdmi;
 	struct dp_audio_infoframe dp;
-	u8 bytes[0];
+	DECLARE_FLEX_ARRAY(u8, bytes);
 };
 
 /*
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 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 array declaration in union audio_infoframe with the new DECLARE_FLEX_ARRAY() helper macro.

This helper allows for a flexible-array member in a union.

Signature · 1 line
Kees Cook
Applied
#2 lore raw
In reply to Gustavo A. R. Silva
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 array declaration in union audio_infoframe with the new DECLARE_FLEX_ARRAY() helper macro.

This helper allows for a flexible-array member in a union.

Thanks, applied to for-next branch.

Takashi