On Thu, May 12, 2022 at 10:41:05PM +0100, David Howells wrote:
>
> Kees Cook wrote:
>
> > struct afs_acl {
> > - u32 size;
> > - u8 data[];
> > + DECLARE_FLEX_ARRAY_ELEMENTS_COUNT(u32, size);
> > + DECLARE_FLEX_ARRAY_ELEMENTS(u8, data);
> > };
>
> Oof... That's really quite
Kees Cook wrote:
> struct afs_acl {
> - u32 size;
> - u8 data[];
> + DECLARE_FLEX_ARRAY_ELEMENTS_COUNT(u32, size);
> + DECLARE_FLEX_ARRAY_ELEMENTS(u8, data);
> };
Oof... That's really quite unpleasant syntax. Is it not possible to have
mem_to_flex_dup() and friends
As part of the work to perform bounds checking on all memcpy() uses,
replace the open-coded a deserialization of bytes out of memory into a
trailing flexible array by using a flex_array.h helper to perform the
allocation, bounds checking, and copying.
Cc: David Howells
Cc: Marc Dionne
Cc: linux-