Skip to contentSkip to conversation

x86/fpu: Replace zero-length array with flexible-array member

PATCH In review Gustavo A. R. Silva 2 participants 2 messages Jan 10, 2023 – Jan 12, 2023 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/fpu: Replace zero-length array with flexible-array member

Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length array declaration in struct xregs_state with flex-array member.

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

---
 arch/x86/include/asm/fpu/types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/fpu/types.h +1 -1
index eb7cd1139d97..7f6d858ff47a 100644
@@ -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)));
 
 /*
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Gustavo A. R. Silva

Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length array declaration in struct xregs_state with flex-array member.

Quoted 8 lines

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

Signature · 1 line
Kees Cook