Skip to content

Commit c0247d2

Browse files
tobluxkdave
authored andcommitted
btrfs: send: annotate struct name_cache_entry with __counted_by()
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>
1 parent 6252690 commit c0247d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/send.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ struct name_cache_entry {
347347
int ret;
348348
int need_later_update;
349349
int name_len;
350-
char name[];
350+
char name[] __counted_by(name_len);
351351
};
352352

353353
/* See the comment at lru_cache.h about struct btrfs_lru_cache_entry. */

0 commit comments

Comments
 (0)