]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ext4: annotate struct fname with __counted_by()
authorThorsten Blum <thorsten.blum@linux.dev>
Tue, 5 Nov 2024 10:18:14 +0000 (11:18 +0100)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 13 Nov 2024 17:56:48 +0000 (12:56 -0500)
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 <jack@suse.cz>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://patch.msgid.link/20241105101813.10864-2-thorsten.blum@linux.dev
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/dir.c

index ef6a3c8f3a9a0609c2fbd9fd24b02004cfc4567d..233479647f1b8bbc85765a6ac465dc6bd75cc461 100644 (file)
@@ -418,7 +418,7 @@ struct fname {
        __u32           inode;
        __u8            name_len;
        __u8            file_type;
-       char            name[];
+       char            name[] __counted_by(name_len);
 };
 
 /*