crypto: nx - annotate struct nx842_crypto_header with __counted_by
Subsystems (3)
PATCH 1/1 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 <[email protected]>
--- drivers/crypto/nx/nx-842.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/nx/nx-842.h +1 -1
@@ -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()" );
Quoted 5 lines · Thorsten Blum
Add the
__counted_by()compiler attribute to the flexible array member 'group' to improve access bounds-checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.Signed-off-by Thorsten Blum <[email protected]>
Reviewed-by Gustavo A. R. Silva <[email protected]>
Thanks
-Gustavo
Quoted 18 lines
--- drivers/crypto/nx/nx-842.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/crypto/nx/nx-842.h +1
-1@@ -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()" );
Herbert Xu
maintainerQuoted 8 lines · Thorsten Blum
Add the
__counted_by()compiler attribute to the flexible array member 'group' to improve access bounds-checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.Signed-off-by Thorsten Blum <[email protected]>--- drivers/crypto/nx/nx-842.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt