[PATCH v2 3/5] treewide: Replace 0-element memcpy() destinations with flexible arrays

Keith Packard keithp at keithp.com
Wed Aug 25 22:24:18 PDT 2021


Kees Cook <keescook at chromium.org> writes:

> In some cases, use of the flex_array() helper is needed when a flexible
> array is part of a union.

The code below seems to show that the helper is also needed when the
flexible array is the only member of a struct? Or is this just an
extension of the 'part of a union' clause?

> @@ -160,7 +160,7 @@ struct bmi_cmd {
>  
>  union bmi_resp {
>  	struct {
> -		u8 payload[0];
> +		DECLARE_FLEX_ARRAY(u8, payload);
>  	} read_mem;
>  	struct {
>  		__le32 result;

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/ath10k/attachments/20210825/16d9ace8/attachment.sig>


More information about the ath10k mailing list