Re: [PATCH] net: core: use __counted_by for trailing VLA of struct sock_reuseport

2024-07-30 Thread Jakub Kicinski
On Tue, 30 Jul 2024 19:04:49 +0300 Dmitry Antipov wrote: > - unsigned int size = sizeof(struct sock_reuseport) + > - sizeof(struct sock *) * max_socks; > - struct sock_reuseport *reuse = kzalloc(size, GFP_ATOMIC); > + struct sock_reuseport *reuse = > + kzal

Re: [PATCH] net: core: use __counted_by for trailing VLA of struct sock_reuseport

2024-07-30 Thread Kuniyuki Iwashima
From: Dmitry Antipov Date: Tue, 30 Jul 2024 19:04:49 +0300 > According to '__reuseport_alloc()', annotate trailing VLA '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 Revie

Re: [PATCH] net: core: use __counted_by for trailing VLA of struct sock_reuseport

2024-07-30 Thread Gustavo A. R. Silva
On 30/07/24 10:04, Dmitry Antipov wrote: According to '__reuseport_alloc()', annotate trailing VLA 'sock' of `socks` is a flexible-array member[1], not a VLA[2]. 'struct sock_reuseport' with '__counted_by()' and use convenient 'struct_size()' to simplify the math used in 'kzalloc()'. > Sig

[PATCH] net: core: use __counted_by for trailing VLA of struct sock_reuseport

2024-07-30 Thread Dmitry Antipov
According to '__reuseport_alloc()', annotate trailing VLA '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 --- include/net/sock_reuseport.h | 2 +- net/core/sock_reuseport.c| 7 +