keys: Annotate struct asymmetric_key_id with __counted_by
Subsystems (3)
PATCH 1/1 keys: Annotate struct asymmetric_key_id with __counted_by
Add the __counted_by() compiler attribute to the flexible array member 'data' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.
Signed-off-by Thorsten Blum <[email protected]>
--- include/keys/asymmetric-type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/keys/asymmetric-type.h +1 -1
@@ -49,7 +49,7 @@ enum asymmetric_payload_bits {*/ struct asymmetric_key_id {unsigned short len; -unsigned char data[]; + unsigned char data[] __counted_by(len); };struct asymmetric_key_ids {
Signature · 1 line
2.51.0
Quoted 5 lines · Thorsten Blum
Add the
__counted_by()compiler attribute to the flexible array member 'data' to improve access bounds-checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.Signed-off-by Thorsten Blum <[email protected]>
Reviewed-by Lukas Wunner <[email protected]>
Quoted 25 lines · Thorsten Blum
Add the
__counted_by()compiler attribute to the flexible array member 'data' to improve access bounds-checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.Signed-off-by Thorsten Blum <[email protected]>--- include/keys/asymmetric-type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/keys/asymmetric-type.h +1
-1@@ -49,7 +49,7 @@ enum asymmetric_payload_bits {*/ struct asymmetric_key_id {unsigned short len; -unsigned char data[]; + unsigned char data[] __counted_by(len); };struct asymmetric_key_ids {Signature · 1 line
2.51.0
Reviewed-by Jarkko Sakkinen <[email protected]>
BR, Jarkko