Commit 7583873c authored by Thorsten Blum's avatar Thorsten Blum Committed by Kees Cook
Browse files

fs/xattr: Annotate struct simple_xattr with __counted_by



Add the __counted_by() compiler attribute to the flexible array member
'value' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.

Reviewed-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarThorsten Blum <thorsten.blum@linux.dev>
Link: https://patch.msgid.link/20260105122057.2347-2-thorsten.blum@linux.dev


Signed-off-by: default avatarKees Cook <kees@kernel.org>
parent dacbfc16
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ struct simple_xattr {
	struct rb_node rb_node;
	char *name;
	size_t size;
	char value[];
	char value[] __counted_by(size);
};

void simple_xattrs_init(struct simple_xattrs *xattrs);