On Wed, Oct 11, 2023 at 02:37:25PM +0800, Ping-Ke Shih wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for > array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family > functions). > > Use struct_size() and flex_array_size() helpers to calculate proper sizes > for allocation and memcpy(). > > Don't change logic at all, and result is identical as before. > > Cc: Kees Cook <keescook@xxxxxxxxxxxx> > Signed-off-by: Ping-Ke Shih <pkshih@xxxxxxxxxxx> Looks good too. Thanks! Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx> -- Kees Cook