Skip to contentSkip to conversation

crypto: af_alg - Annotate struct af_alg_iv with __counted_by

PATCH RESEND Applied Thorsten Blum 2 participants 2 messages Jan 5 – Jan 12

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 crypto: af_alg - Annotate struct af_alg_iv with __counted_by

Add the __counted_by() compiler attribute to the flexible array member 'iv' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.

---
 include/uapi/linux/if_alg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/if_alg.h +1 -1
index b35871cbeed7..4f51e198ac2e 100644
@@ -42,7 +42,7 @@ struct sockaddr_alg_new {
 
 struct af_alg_iv {
 	__u32	ivlen;
-	__u8	iv[];
+	__u8	iv[] __counted_by(ivlen);
 };
 
 /* Socket options */
Signature · 2 lines
Thorsten Blum <[email protected]>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4
Applied
#1 lore raw
Quoted 5 lines · Thorsten Blum

Add the __counted_by() compiler attribute to the flexible array member 'iv' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.

Applied to for-next/hardening, thanks!

[1/1] crypto: af_alg - Annotate struct af_alg_iv with __counted_by

      https://git.kernel.org/kees/c/98569017111e

Take care,

Signature · 1 line
Kees Cook