Skip to content

Commit 5b5caf2

Browse files
alanskindjfvogel
authored andcommitted
bcachefs: Remove incorrect __counted_by annotation
commit 6846100b00d97d3d6f05766ae86a0d821d849e78 upstream. This actually reverts 86e92ee ("bcachefs: Annotate struct bch_xattr with __counted_by()"). After the x_name, there is a value. According to the disscussion[1], __counted_by assumes that the flexible array member contains exactly the amount of elements that are specified. Now there are users came across a false positive detection of an out of bounds write caused by the __counted_by here[2], so revert that. [1] https://lore.kernel.org/lkml/Zv8VDKWN1GzLRT-_@archlinux/T/#m0ce9541c5070146320efd4f928cc1ff8de69e9b2 [2] https://privatebin.net/?a0d4e97d590d71e1#9bLmp2Kb5NU6X6cZEucchDcu88HzUQwHUah8okKPReEt Signed-off-by: Alan Huang <[email protected]> Signed-off-by: Kent Overstreet <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 6b6cd389104c2dc34dbdea2b1ba48fea8c39b24e) Signed-off-by: Jack Vogel <[email protected]>
1 parent b0b3478 commit 5b5caf2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fs/bcachefs/xattr_format.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ struct bch_xattr {
1313
__u8 x_type;
1414
__u8 x_name_len;
1515
__le16 x_val_len;
16-
__u8 x_name[] __counted_by(x_name_len);
16+
/*
17+
* x_name contains the name and value counted by
18+
* x_name_len + x_val_len. The introduction of
19+
* __counted_by(x_name_len) caused a false positive
20+
* detection of an out of bounds write.
21+
*/
22+
__u8 x_name[];
1723
} __packed __aligned(8);
1824

1925
#endif /* _BCACHEFS_XATTR_FORMAT_H */

0 commit comments

Comments
 (0)