]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ext4: annotate struct ext4_xattr_inode_array with __counted_by()
authorThorsten Blum <thorsten.blum@toblux.com>
Tue, 30 Jul 2024 22:02:02 +0000 (00:02 +0200)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 27 Aug 2024 03:40:06 +0000 (23:40 -0400)
commit01cdf03b1378f2d860d4eb5951895a92002226a3
treea06dbfc1bc770339720d990c54ef410eb3e66be9
parent736c24e62e7e1f5d00fb5b750bb7c13c56410d07
ext4: annotate struct ext4_xattr_inode_array with __counted_by()

Add the __counted_by compiler attribute to the flexible array member
inodes to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.

Remove the now obsolete comment on the count field.

In ext4_expand_inode_array(), use struct_size() instead of offsetof()
and remove the local variable count. Increment the count field before
adding a new inode to the inodes array.

Compile-tested only.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Link: https://patch.msgid.link/20240730220200.410939-3-thorsten.blum@toblux.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/xattr.c
fs/ext4/xattr.h