Skip to contentSkip to conversation

smb: Annotate struct xattr_smb_acl with __counted_by()

PATCH Applied Thorsten Blum 2 participants 2 messages Aug 23, 2024 – Aug 24, 2024

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

PATCH 1/1 smb: Annotate struct xattr_smb_acl with __counted_by()

Add the __counted_by compiler attribute to the flexible array member entries to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.

---
 fs/smb/server/xattr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/server/xattr.h +1 -1
index 16499ca5c82d..fa3e27d6971b 100644
@@ -76,7 +76,7 @@ struct xattr_acl_entry {
 struct xattr_smb_acl {
 	int count;
 	int next;
-	struct xattr_acl_entry entries[];
+	struct xattr_acl_entry entries[] __counted_by(count);
 };
 
 /* 64bytes hash in xattr_ntacl is computed with sha256 */
Signature · 1 line
2.46.0
maintainer Applied
#1 lore raw
Quoted 6 lines · Thorsten Blum

Add the __counted_by compiler attribute to the flexible array member entries to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.

Applied it to #ksmbd-for-next-next.
Thanks!