]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bcachefs: Annotate struct bch_xattr with __counted_by()
authorThorsten Blum <thorsten.blum@toblux.com>
Sat, 24 Aug 2024 13:57:41 +0000 (15:57 +0200)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 9 Sep 2024 13:41:49 +0000 (09:41 -0400)
Add the __counted_by compiler attribute to the flexible array member
x_name to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/xattr_format.h

index e9f810539552ef6d47024d6a8c21967417ebf6a4..c7916011ef34d3b51c3925a5f6524e4f28f2638f 100644 (file)
@@ -13,7 +13,7 @@ struct bch_xattr {
        __u8                    x_type;
        __u8                    x_name_len;
        __le16                  x_val_len;
-       __u8                    x_name[];
+       __u8                    x_name[] __counted_by(x_name_len);
 } __packed __aligned(8);
 
 #endif /* _BCACHEFS_XATTR_FORMAT_H */