Skip to contentSkip to conversation

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

PATCH In review Gustavo A. R. Silva 2 participants 2 messages Sep 2, 2022 – Sep 3, 2022 Filesystems exportfs

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exportfs: 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 struct fid with the new DECLARE_FLEX_ARRAY() helper macro.

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

---
 include/linux/exportfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/exportfs.h +1 -1
index fe848901fcc3..1640d97e4c0d 100644
@@ -131,7 +131,7 @@ struct fid {
  			u32 parent_block;
  			u32 parent_generation;
  		} udf;
-		__u32 raw[0];
+		DECLARE_FLEX_ARRAY(__u32, raw);
 	};
 };
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
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 array declaration in struct fid with the new DECLARE_FLEX_ARRAY() helper macro.

Quoted 7 lines

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

Signature · 1 line
Kees Cook