From: Thorsten Blum Date: Tue, 5 Nov 2024 10:18:14 +0000 (+0100) Subject: ext4: annotate struct fname with __counted_by() X-Git-Tag: v6.13-rc1~214^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de183b2baf90f0acc1854a3998c14b8b228f9643;p=thirdparty%2Fkernel%2Fstable.git ext4: annotate struct fname 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. Reviewed-by: Jan Kara Signed-off-by: Thorsten Blum Link: https://patch.msgid.link/20241105101813.10864-2-thorsten.blum@linux.dev Signed-off-by: Theodore Ts'o --- diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index ef6a3c8f3a9a0..233479647f1b8 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -418,7 +418,7 @@ struct fname { __u32 inode; __u8 name_len; __u8 file_type; - char name[]; + char name[] __counted_by(name_len); }; /*