Skip to content

Commit

Permalink
x86/fpu: Replace zero-length array in struct xregs_state with flexibl…
Browse files Browse the repository at this point in the history
…e-array member

Zero-length arrays are deprecated [1] and have to be replaced by C99
flexible-array members.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines
on memcpy() and help to make progress towards globally enabling
-fstrict-flex-arrays=3 [2]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays [1]
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [2]
Link: https://github.com/KSPP/linux/issues/78
Link: https://lore.kernel.org/r/Y7zCFpa2XNs/o9YQ@work
  • Loading branch information
Gustavo A. R. Silva authored and Thomas Gleixner committed Jan 19, 2023
1 parent 5dc4c99 commit aa81cb9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/include/asm/fpu/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ struct xstate_header {
struct xregs_state {
struct fxregs_state i387;
struct xstate_header header;
u8 extended_state_area[0];
u8 extended_state_area[];
} __attribute__ ((packed, aligned (64)));

/*
Expand Down

0 comments on commit aa81cb9

Please sign in to comment.