Skip to contentSkip to conversation

fs/ufs: use flexible-array members in on-disk structs

PATCH New Muhammad Mahdi Amirpour 1 participant 1 message Oct 7 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/ufs: use flexible-array members in on-disk structs

Replace one-element arrays with flexible-array members in the UFS on-disk structures ufs_cylinder_group, ufs_old_cylinder_group, and ufs_super_block_third.

Zero-length and one-element arrays are deprecated; the preferred mechanism for such trailing arrays is an empty square bracket array.

All three fields are the last member of their struct, so their offset within the struct is unchanged. The accessor macros in ufs_fs.h and the field layout on disk continue to work identically. No functional change.

---
 fs/ufs/ufs_fs.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ufs/ufs_fs.h +3 -3
index b8dc354ae..6c0493d69 100644
@@ -571,7 +571,7 @@ struct	ufs_cylinder_group {
 		} cg_u2;
 		__fs32	cg_sparecon[16];	/* reserved for future use */
 	} cg_u;
-	__u8	cg_space[1];		/* space for cylinder group maps */
+	__u8	cg_space[];		/* space for cylinder group maps */
 /* actually longer */
 };
 
@@ -593,7 +593,7 @@ struct ufs_old_cylinder_group {
 	__fs16	cg_b[32][8];		/* positions of free blocks */
 	__u8	cg_iused[256];		/* used inode map */
 	__fs32	cg_magic;		/* magic number */
-	__u8	cg_free[1];		/* free block map */
+	__u8	cg_free[];		/* free block map */
 /* actually longer */
 };
 
@@ -952,7 +952,7 @@ struct ufs_super_block_third {
 	__fs32	fs_postbloff;
 	__fs32	fs_rotbloff;
 	__fs32	fs_magic;
-	__u8	fs_space[1];
+	__u8	fs_space[];
 };
 
 #endif /* __LINUX_UFS_FS_H */
Signature · 1 line
2.55.0