fs/xattr: Annotate struct simple_xattr with __counted_by
PATCH RESEND 1/1 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.
Signed-off-by Thorsten Blum <[email protected]>
--- include/linux/xattr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/xattr.h +1 -1
@@ -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);
Signature · 1 line
2.51.1
Quoted 5 lines · Thorsten Blum
Add the
__counted_by()compiler attribute to the flexible array member 'value' to improve access bounds-checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.Signed-off-by Thorsten Blum <[email protected]>
Looks good. Feel free to add:
Reviewed-by Jan Kara <[email protected]>
Honza
Quoted 20 lines
--- include/linux/xattr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/xattr.h +1
-1@@ -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);Signature · 1 line
2.51.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR