From linux-wireless Thu Aug 26 05:24:18 2021 From: Keith Packard Date: Thu, 26 Aug 2021 05:24:18 +0000 To: linux-wireless Subject: Re: [PATCH v2 3/5] treewide: Replace 0-element memcpy() destinations with flexible arrays Message-Id: <87r1egpym5.fsf () keithp ! com> X-MARC-Message: https://marc.info/?l=linux-wireless&m=162995595802479 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Kees Cook 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 { >=20=20 > union bmi_resp { > struct { > - u8 payload[0]; > + DECLARE_FLEX_ARRAY(u8, payload); > } read_mem; > struct { > __le32 result; =2D-=20 =2Dkeith --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAmEnJYIACgkQ2yIaaQAA ABFJwg/9HnuEf5sIRlyVndEk8XKVsPy1mM63I9dwsOPTB031099GdKund7uEfybJ 1kjf3GQv9nMAM0Cq3Uoiqfqv2liuTW2dGKBY2wHAVOtWjQXyTiN3NP3iNx1kVd7X txLF08RakTjjbca72QM9P47VuaJMHchiiYQfGrUxaQY9/lUuyR1DawpZLomXT9kV fUuBUpYUO/Xta1zs/e6IudCJRL0h6Hlk2nLqV+zrjTNsbEhI+Ztd0Lv40VrIVfUJ ZXMCNHomviUCwybnTodcUdtWYU5JqokjGWqYZawyErshiEew6AiM1e5CHkl0fDQU OUSteni1sY0nJ32L74MN0A2vjPcOeY3lzE8FTxeY7BzbAorxELYD4jBXhopA0+MW CPXS0xfn6crMm2vyFH+6YB2udPlLr1+n0qfxaYr36Tr+dZ81D0lJ5g5UjX4J6q3G nqx/vxHjWYvTQpHVZCstuABCHad/J/0X9SRS4xwu4983bMwDOCfKCkF+RNitHfpO /m+mzWJYEQokqKtj/V8i1PDUYhpWO9Kx7G2zQZ31le75zrcfKmBccid3m65Z0OAD e0w8NfJ1NDwSFTl4duKB8gE5gNKuppuzLlDBQWhrqIK+5mKCapZ0sCjSqJjVxNjK Q41Bm6/blVaF0IaP2fnjEbyQYhy9tbuVEwYZ630P5ctqCHxsZ40= =cojg -----END PGP SIGNATURE----- --=-=-=--