Re: [PATCH 19/32] afs: Use mem_to_flex_dup() with struct afs_acl

2022-05-13 Thread Kees Cook
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

Re: [PATCH 19/32] afs: Use mem_to_flex_dup() with struct afs_acl

2022-05-12 Thread David Howells
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

[PATCH 19/32] afs: Use mem_to_flex_dup() with struct afs_acl

2022-05-03 Thread Kees Cook
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-