]> www.infradead.org Git - users/jedix/linux-maple.git/commit
acl: Annotate struct posix_acl with __counted_by()
authorThorsten Blum <thorsten.blum@linux.dev>
Fri, 18 Oct 2024 12:14:21 +0000 (14:14 +0200)
committerChristian Brauner <brauner@kernel.org>
Tue, 22 Oct 2024 09:16:59 +0000 (11:16 +0200)
commit8c6e03ffedc5463d1aa1ba89f6ceb082518a3520
tree0ca5dd6c019d96f55cfd7ff9ec1cc0369f1c5460
parent99bdadbde9c418f29b78b7241732268dbc0a05cc
acl: Annotate struct posix_acl with __counted_by()

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

Use struct_size() to calculate the number of bytes to allocate for new
and cloned acls and remove the local size variables.

Change the posix_acl_alloc() function parameter count from int to
unsigned int to match posix_acl's a_count data type. Add identifier
names to the function definition to silence two checkpatch warnings.

Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20241018121426.155247-2-thorsten.blum@linux.dev
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/posix_acl.c
include/linux/posix_acl.h