Skip to contentSkip to conversation

fbdev/amifb: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper

PATCH Applied Atul Raut 2 participants 2 messages Jul 31, 2023 Framebuffer layer

lore
Share & tools
lore

Atul Raut

author
#0 lore raw

PATCH 1/1 fbdev/amifb: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper

Replacing zero-length arrays with C99 flexible-array members because they are deprecated. Use the new DECLARE_FLEX_ARRAY() auxiliary macro instead of defining a zero-length array.

This fixes warnings such as:
./drivers/video/fbdev/amifb.c:690:6-10: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

---
 drivers/video/fbdev/amifb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/amifb.c +1 -1
index d88265dbebf4..f216b2c702a1 100644
@@ -687,7 +687,7 @@ struct fb_var_cursorinfo {
 	__u16 height;
 	__u16 xspot;
 	__u16 yspot;
-	__u8 data[1];			/* field with [height][width]        */
+	DECLARE_FLEX_ARRAY(__u8, data);	/* field with [height][width]        */
 };
 
 struct fb_cursorstate {
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 8 lines · Atul Raut

Replacing zero-length arrays with C99 flexible-array members because they are deprecated. Use the new DECLARE_FLEX_ARRAY() auxiliary macro instead of defining a zero-length array.

This fixes warnings such as:
./drivers/video/fbdev/amifb.c:690:6-10: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

applied.
Thanks!
Helge

Quoted 17 lines
---
  drivers/video/fbdev/amifb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/amifb.c +1 -1
index d88265dbebf4..f216b2c702a1 100644
@@ -687,7 +687,7 @@ struct fb_var_cursorinfo {
  	__u16 height;
  	__u16 xspot;
  	__u16 yspot;
-	__u8 data[1];			/* field with [height][width]        */
+	DECLARE_FLEX_ARRAY(__u8, data);	/* field with [height][width]        */
  };
 
  struct fb_cursorstate {