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 <thorsten.blum@linux.dev>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Thorsten Blum 2025-10-23 19:48:11 +02:00 committed by Herbert Xu
parent 841940df6f
commit 12ad5b2346
1 changed files with 1 additions and 1 deletions

View File

@ -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 {