]> www.infradead.org Git - users/willy/xarray.git/commitdiff
smb: Annotate struct xattr_smb_acl with __counted_by()
authorThorsten Blum <thorsten.blum@toblux.com>
Fri, 23 Aug 2024 11:47:05 +0000 (13:47 +0200)
committerSteve French <stfrench@microsoft.com>
Fri, 30 Aug 2024 01:28:36 +0000 (20:28 -0500)
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.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/xattr.h

index 16499ca5c82d366b29eb36ff2416b7b76835cc9b..fa3e27d6971b823fbab047593bf1847fd185321f 100644 (file)
@@ -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 */