Skip to content

Commit

Permalink
fs/select: Annotate struct poll_list with __counted_by()
Browse files Browse the repository at this point in the history
Add the __counted_by compiler attribute to the flexible array member
entries to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Link: https://lore.kernel.org/r/20240808150023.72578-2-thorsten.blum@toblux.com
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
  • Loading branch information
Thorsten Blum authored and Christian Brauner committed Aug 30, 2024
1 parent 0f93bb5 commit 193b727
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/select.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ SYSCALL_DEFINE1(old_select, struct sel_arg_struct __user *, arg)
struct poll_list {
struct poll_list *next;
unsigned int len;
struct pollfd entries[];
struct pollfd entries[] __counted_by(len);
};

#define POLLFD_PER_PAGE ((PAGE_SIZE-sizeof(struct poll_list)) / sizeof(struct pollfd))
Expand Down

0 comments on commit 193b727

Please sign in to comment.