Skip to content

Commit a8f014e

Browse files
committed
vboxsf: Use flexible arrays for trailing string member
The declaration of struct shfl_string used trailing fake flexible arrays for the string member. This was tripping FORTIFY_SOURCE since commit df8fc4e ("kbuild: Enable -fstrict-flex-arrays=3"). Replace the utf8 and utf16 members with actual flexible arrays, drop the unused ucs2 member, and retriain a 2 byte padding to keep the structure size the same. Reported-by: Larry Finger <[email protected]> Closes: https://lore.kernel.org/lkml/[email protected]/ Tested-by: Larry Finger <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent ec7633d commit a8f014e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/vboxsf/shfl_hostintf.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ struct shfl_string {
6868

6969
/** UTF-8 or UTF-16 string. Nul terminated. */
7070
union {
71-
u8 utf8[2];
72-
u16 utf16[1];
73-
u16 ucs2[1]; /* misnomer, use utf16. */
71+
u8 legacy_padding[2];
72+
DECLARE_FLEX_ARRAY(u8, utf8);
73+
DECLARE_FLEX_ARRAY(u16, utf16);
7474
} string;
7575
};
7676
VMMDEV_ASSERT_SIZE(shfl_string, 6);

0 commit comments

Comments
 (0)