carl9170: Replace zero-length array of trailing structs with flex-array
PATCH 1/1 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
--- drivers/net/wireless/ath/carl9170/fwcmd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/carl9170/fwcmd.h +2 -2
@@ -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 {
Signature · 1 line
2.34.1
Quoted 11 lines · Kees Cook
Zero-length arrays are deprecated[1] and are being replaced with flexible array members in support of the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy(), correctly instrument array indexing withUBSAN_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.
Quoted 10 lines
Cc Christian Lamparter <[email protected]>Cc Kalle Valo <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Cc "Gustavo A. R. Silva" <[email protected]>Signed-off-by Kees Cook <[email protected]>
Another sneaky one. :p
Thanks!
--
Gustavo
Quoted 24 lines
--- drivers/net/wireless/ath/carl9170/fwcmd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/wireless/ath/carl9170/fwcmd.h +2
-2@@ -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 {Signature · 1 line
2.34.1
Quoted 11 lines · Kees Cook
Zero-length arrays are deprecated[1] and are being replaced with flexible array members in support of the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy(), correctly instrument array indexing withUBSAN_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.
Quoted 10 lines
Cc Christian Lamparter <[email protected]>Cc Kalle Valo <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Cc "Gustavo A. R. Silva" <[email protected]>Signed-off-by Kees Cook <[email protected]>
Quoted 21 lines
--- drivers/net/wireless/ath/carl9170/fwcmd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/wireless/ath/carl9170/fwcmd.h +2
-2@@ -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 {
Quoted 11 lines · Kees Cook
Zero-length arrays are deprecated[1] and are being replaced with flexible array members in support of the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy(), correctly instrument array indexing withUBSAN_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.
Quoted 10 lines
Cc Christian Lamparter <[email protected]>Cc Kalle Valo <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Cc "Gustavo A. R. Silva" <[email protected]>Signed-off-by Kees Cook <[email protected]>
Nowadays we include "wifi:" in the subject, but I can add that. But please use this in the future for all wireless patches.
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 24 lines · Kalle Valo
Quoted 11 lines · Kees Cook
Zero-length arrays are deprecated[1] and are being replaced with flexible array members in support of the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy(), correctly instrument array indexing withUBSAN_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.
Quoted 10 lines
Cc Christian Lamparter <[email protected]>Cc Kalle Valo <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Cc "Gustavo A. R. Silva" <[email protected]>Signed-off-by Kees Cook <[email protected]>
Quoted 2 lines
Nowadays we include "wifi:" in the subject, but I can add that. But please use this in the future for all wireless patches.
Okay, thanks! I use a recency/frequency prefix guesser, but I've updated it to include "wifi: " if "[email protected]" is in CC. :)
Signature · 1 line
Kees Cook
Quoted 11 lines · Kees Cook
Zero-length arrays are deprecated[1] and are being replaced with flexible array members in support of the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy(), correctly instrument array indexing withUBSAN_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.
Quoted 13 lines
Cc Christian Lamparter <[email protected]>Cc Kalle Valo <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Cc "Gustavo A. R. Silva" <[email protected]>Signed-off-by Kees Cook <[email protected]>Reviewed-by Gustavo A. R. Silva <[email protected]>Signed-off-by Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
7256f28767fa wifi: carl9170: Replace zero-length array of trailing structs with flex-array
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches