]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
btrfs: send: annotate struct name_cache_entry with __counted_by()
authorThorsten Blum <thorsten.blum@toblux.com>
Tue, 13 Aug 2024 10:53:15 +0000 (12:53 +0200)
committerDavid Sterba <dsterba@suse.com>
Thu, 15 Aug 2024 18:35:32 +0000 (20:35 +0200)
Add the __counted_by compiler attribute to the flexible array member
name to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/send.c

index 7fc692fc76e1502c83aa7c148b46f2c6211a0634..619fa0b8b3f6f9818e72971ea7e1d42b4b298310 100644 (file)
@@ -347,7 +347,7 @@ struct name_cache_entry {
        int ret;
        int need_later_update;
        int name_len;
-       char name[];
+       char name[] __counted_by(name_len);
 };
 
 /* See the comment at lru_cache.h about struct btrfs_lru_cache_entry. */