From: Thorsten Blum Date: Mon, 5 Aug 2024 22:11:30 +0000 (+0200) Subject: crypto: chacha20poly1305 - Annotate struct chachapoly_ctx with __counted_by() X-Git-Tag: v6.12-rc1~78^2~73 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=18e2188c4b2069cf52c12344b47b4f7ac982f555;p=linux-block.git crypto: chacha20poly1305 - Annotate struct chachapoly_ctx with __counted_by() Add the __counted_by compiler attribute to the flexible array member salt to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Reviewed-by: Kees Cook Signed-off-by: Thorsten Blum Signed-off-by: Herbert Xu --- diff --git a/crypto/chacha20poly1305.c b/crypto/chacha20poly1305.c index 9e4651330852..d740849f1c19 100644 --- a/crypto/chacha20poly1305.c +++ b/crypto/chacha20poly1305.c @@ -27,7 +27,7 @@ struct chachapoly_ctx { struct crypto_ahash *poly; /* key bytes we use for the ChaCha20 IV */ unsigned int saltlen; - u8 salt[]; + u8 salt[] __counted_by(saltlen); }; struct poly_req {