From: Thorsten Blum Date: Tue, 17 Mar 2026 20:18:06 +0000 (+0100) Subject: crypto: nx - annotate struct nx842_crypto_header with __counted_by X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=928c5e894ca907b11c0b3cda7c37441d863018fd;p=thirdparty%2Flinux.git crypto: nx - annotate struct nx842_crypto_header with __counted_by Add the __counted_by() compiler attribute to the flexible array member 'group' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Signed-off-by: Thorsten Blum Reviewed-by: Gustavo A. R. Silva Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/nx/nx-842.h b/drivers/crypto/nx/nx-842.h index f5e2c82ba8768..a04e85e9f78e3 100644 --- a/drivers/crypto/nx/nx-842.h +++ b/drivers/crypto/nx/nx-842.h @@ -164,7 +164,7 @@ struct nx842_crypto_header { __be16 ignore; /* decompressed end bytes to ignore */ u8 groups; /* total groups in this header */ ); - struct nx842_crypto_header_group group[]; + struct nx842_crypto_header_group group[] __counted_by(groups); } __packed; static_assert(offsetof(struct nx842_crypto_header, group) == sizeof(struct nx842_crypto_header_hdr), "struct member likely outside of struct_group_tagged()");