All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Paolo Abeni <pabeni@redhat.com>, Kees Cook <kees@kernel.org>,
	netdev@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] net: core: use __counted_by for trailing VLA of struct sock_reuseport
Date: Tue, 30 Jul 2024 17:01:42 -0700	[thread overview]
Message-ID: <20240730170142.32a6e9aa@kernel.org> (raw)
In-Reply-To: <20240730160449.368698-1-dmantipov@yandex.ru>

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

  parent reply	other threads:[~2024-07-31  0:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-30 16:04 [PATCH] net: core: use __counted_by for trailing VLA of struct sock_reuseport Dmitry Antipov
2024-07-30 18:41 ` Gustavo A. R. Silva
2024-07-30 19:06 ` Kuniyuki Iwashima
2024-07-31  0:01 ` Jakub Kicinski [this message]
2024-07-31  4:53   ` [PATCH v2] net: core: annotate socks of struct sock_reuseport with __counted_by Dmitry Antipov
2024-07-31 23:50     ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240730170142.32a6e9aa@kernel.org \
    --to=kuba@kernel.org \
    --cc=dmantipov@yandex.ru \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.