mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-23 17:41:24 -05:00
This actually reverts 86e92eeeb2 ("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 <mmpgouride@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
26 lines
708 B
C
26 lines
708 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _BCACHEFS_XATTR_FORMAT_H
|
|
#define _BCACHEFS_XATTR_FORMAT_H
|
|
|
|
#define KEY_TYPE_XATTR_INDEX_USER 0
|
|
#define KEY_TYPE_XATTR_INDEX_POSIX_ACL_ACCESS 1
|
|
#define KEY_TYPE_XATTR_INDEX_POSIX_ACL_DEFAULT 2
|
|
#define KEY_TYPE_XATTR_INDEX_TRUSTED 3
|
|
#define KEY_TYPE_XATTR_INDEX_SECURITY 4
|
|
|
|
struct bch_xattr {
|
|
struct bch_val v;
|
|
__u8 x_type;
|
|
__u8 x_name_len;
|
|
__le16 x_val_len;
|
|
/*
|
|
* x_name contains the name and value counted by
|
|
* x_name_len + x_val_len. The introduction of
|
|
* __counted_by(x_name_len) caused a false positive
|
|
* detection of an out of bounds write.
|
|
*/
|
|
__u8 x_name[];
|
|
} __packed __aligned(8);
|
|
|
|
#endif /* _BCACHEFS_XATTR_FORMAT_H */
|