From: Gustavo A. R. Silva Date: Tue, 10 Jan 2023 01:40:38 +0000 (-0600) Subject: x86/fpu: Replace zero-length array in struct xregs_state with flexible-array member X-Git-Tag: v6.6.7~3521^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aa81cb9d9723694bb18359adbef7964030758dba;p=platform%2Fkernel%2Flinux-starfive.git x86/fpu: Replace zero-length array in struct xregs_state with flexible-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 Signed-off-by: Thomas Gleixner Reviewed-by: Kees Cook 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 --- diff --git a/arch/x86/include/asm/fpu/types.h b/arch/x86/include/asm/fpu/types.h index eb7cd11..7f6d858 100644 --- a/arch/x86/include/asm/fpu/types.h +++ b/arch/x86/include/asm/fpu/types.h @@ -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))); /*