]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
crypto: zstd - Annotate struct zstd_ctx with __counted_by
authorThorsten Blum <thorsten.blum@linux.dev>
Sat, 8 Nov 2025 12:07:40 +0000 (13:07 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 14 Nov 2025 10:15:49 +0000 (18:15 +0800)
commit6cf32607555da7ef99005ff0d73f3d8597cbbd04
treefd543d24b30e47494bd9506c915a68d9a58efb3b
parentaf3852cda347a72335c7625f92b29d31495aeeda
crypto: zstd - Annotate struct zstd_ctx with __counted_by

Add the __counted_by() compiler attribute to the flexible array member
'wksp' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.

Use struct_size(), which provides additional compile-time checks for
structures with flexible array members (e.g., __must_be_array()), for
the allocation size for a new 'zstd_ctx' while we're at it.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/zstd.c