Skip to content

Commit 86e92ee

Browse files
tobluxKent Overstreet
authored andcommitted
bcachefs: Annotate struct bch_xattr with __counted_by()
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 <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
1 parent 2c6a7bf commit 86e92ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/bcachefs/xattr_format.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct bch_xattr {
1313
__u8 x_type;
1414
__u8 x_name_len;
1515
__le16 x_val_len;
16-
__u8 x_name[];
16+
__u8 x_name[] __counted_by(x_name_len);
1717
} __packed __aligned(8);
1818

1919
#endif /* _BCACHEFS_XATTR_FORMAT_H */

0 commit comments

Comments
 (0)