From: Kees Cook Date: Fri, 18 Nov 2022 21:11:47 +0000 (-0800) Subject: carl9170: Replace zero-length array of trailing structs with flex-array X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=ecb68a78e6a4cc7be7d219a69652cc5e8097d14a;p=carl9170fw.git carl9170: Replace zero-length array of trailing structs with flex-array Zero-length arrays are deprecated[1] and are being replaced with flexible array members in support of the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3. Replace zero-length array with flexible-array member. This results in no differences in binary output. [1] https://github.com/KSPP/linux/issues/78 Cc: Christian Lamparter Cc: Kalle Valo Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: "Gustavo A. R. Silva" Cc: linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: Christian Lamparter --- diff --git a/include/shared/fwcmd.h b/include/shared/fwcmd.h index 4a50009..ff4b3b5 100644 --- a/include/shared/fwcmd.h +++ b/include/shared/fwcmd.h @@ -118,10 +118,10 @@ struct carl9170_reg_list { } __packed; struct carl9170_write_reg { - struct { + DECLARE_FLEX_ARRAY(struct { __le32 addr; __le32 val; - } regs[0] __packed; + } __packed, regs); } __packed; struct carl9170_write_reg_byte {