The patch titled Subject: hpfs: replace one-element array with flexible-array member has been added to the -mm tree. Its filename is hpfs-replace-one-element-array-with-flexible-array-member.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/hpfs-replace-one-element-array-with-flexible-array-member.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/hpfs-replace-one-element-array-with-flexible-array-member.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: "Gustavo A. R. Silva" <gustavoars@xxxxxxxxxx> Subject: hpfs: replace one-element array with flexible-array member There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. Also, this helps with the ongoing efforts to enable -Warray-bounds by fixing the following warning: CC [M] fs/hpfs/dir.o fs/hpfs/dir.c: In function `hpfs_readdir': fs/hpfs/dir.c:163:41: warning: array subscript 1 is above array bounds of `u8[1]' {aka `unsigned char[1]'} [-Warray-bounds] 163 | || de ->name[0] != 1 || de->name[1] != 1)) | ~~~~~~~~^~~ [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://www.kernel.org/doc/html/v5.10/process/deprecated.html#zero-length-and-one-element-arrays Link: https://github.com/KSPP/linux/issues/79 Link: https://github.com/KSPP/linux/issues/109 Link: https://lkml.kernel.org/r/20210326173510.GA81212@embeddedor Signed-off-by: Gustavo A. R. Silva <gustavoars@xxxxxxxxxx> Cc: Mikulas Patocka <mikulas@xxxxxxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/hpfs/hpfs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/hpfs/hpfs.h~hpfs-replace-one-element-array-with-flexible-array-member +++ a/fs/hpfs/hpfs.h @@ -356,7 +356,8 @@ struct hpfs_dirent { u8 no_of_acls; /* number of ACL's (low 3 bits) */ u8 ix; /* code page index (of filename), see struct code_page_data */ - u8 namelen, name[1]; /* file name */ + u8 namelen; /* file name length */ + u8 name[]; /* file name */ /* dnode_secno down; btree down pointer, if present, follows name on next word boundary, or maybe it precedes next dirent, which is on a word boundary. */ _ Patches currently in -mm which might be from gustavoars@xxxxxxxxxx are hfsplus-fix-out-of-bounds-warnings-in-__hfsplus_setxattr.patch hpfs-replace-one-element-array-with-flexible-array-member.patch