[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240730170142.32a6e9aa@kernel.org>
Date: Tue, 30 Jul 2024 17:01:42 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Dmitry Antipov <dmantipov@...dex.ru>
Cc: Paolo Abeni <pabeni@...hat.com>, Kees Cook <kees@...nel.org>,
netdev@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] net: core: use __counted_by for trailing VLA of struct
sock_reuseport
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 =
> + kzalloc(struct_size(reuse, socks, max_socks), GFP_ATOMIC);
>
please move the function call out of the init. It doesn't fit on a
single line so what's the point..
> - if (!reuse)
> + if (unlikely(!reuse))
And why add the unlikely here? Seems unrelated..
--
pw-bot: cr
Powered by blists - more mailing lists