summaryrefslogtreecommitdiffstats
path: root/include/net/sock_reuseport.h
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2024-08-01 16:23:11 +0200
committerJakub Kicinski <kuba@kernel.org>2024-08-03 02:16:59 +0200
commitf94074687d05aea10b50c4f4055a19d9d0c3bd27 (patch)
treed95db90595b4d8a5e70ebe7f5d8dd3e62c343038 /include/net/sock_reuseport.h
parenttipc: guard against string buffer overrun (diff)
downloadlinux-f94074687d05aea10b50c4f4055a19d9d0c3bd27.tar.xz
linux-f94074687d05aea10b50c4f4055a19d9d0c3bd27.zip
net: core: annotate socks of struct sock_reuseport with __counted_by
According to '__reuseport_alloc()', annotate flexible array member 'sock' of 'struct sock_reuseport' with '__counted_by()' and use convenient 'struct_size()' to simplify the math used in 'kzalloc()'. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> Link: https://patch.msgid.link/20240801142311.42837-1-dmantipov@yandex.ru Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net/sock_reuseport.h')
-rw-r--r--include/net/sock_reuseport.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/sock_reuseport.h b/include/net/sock_reuseport.h
index 6ec140b0a61b..6e4faf3ee76f 100644
--- a/include/net/sock_reuseport.h
+++ b/include/net/sock_reuseport.h
@@ -26,7 +26,7 @@ struct sock_reuseport {
unsigned int bind_inany:1;
unsigned int has_conns:1;
struct bpf_prog __rcu *prog; /* optional BPF sock selector */
- struct sock *socks[]; /* array of sock pointers */
+ struct sock *socks[] __counted_by(max_socks);
};
extern int reuseport_alloc(struct sock *sk, bool bind_inany);