From: Simon Horman <horms@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Pravin B Shelar <pshelar@ovn.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
dev@openvswitch.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [ovs-dev] [PATCH v2 1/2] net: openvswitch: Use struct_size()
Date: Tue, 17 Oct 2023 11:09:22 +0200 [thread overview]
Message-ID: <20231017090922.GQ1751252@kernel.org> (raw)
In-Reply-To: <e5122b4ff878cbf3ed72653a395ad5c4da04dc1e.1697264974.git.christophe.jaillet@wanadoo.fr>
On Sat, Oct 14, 2023 at 08:34:52AM +0200, Christophe JAILLET wrote:
> Use struct_size() instead of hand writing it.
> This is less verbose and more robust.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v2: No change
>
> v1: https://lore.kernel.org/all/8be59c9e06fca8eff2f264abb4c2f74db0b19a9e.1696156198.git.christophe.jaillet@wanadoo.fr/
>
>
> This is IMHO more readable, even if not perfect.
>
> However (untested):
> + new = kzalloc(size_add(struct_size(new, masks, size),
> size_mul(sizeof(u64), size)), GFP_KERNEL);
> looks completely unreadable to me.
Thanks, this looks correct (and more readable) to me.
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2023-10-17 9:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-14 6:34 [PATCH v2 1/2] net: openvswitch: Use struct_size() Christophe JAILLET
2023-10-14 6:34 ` [PATCH v2 2/2] net: openvswitch: Annotate struct mask_array with __counted_by Christophe JAILLET
2023-10-15 2:29 ` Kees Cook
2023-10-15 4:53 ` Julia Lawall
2023-10-15 7:20 ` Christophe JAILLET
2023-10-17 9:10 ` [ovs-dev] " Simon Horman
2023-10-17 9:09 ` Simon Horman [this message]
2023-10-17 13:50 ` [PATCH v2 1/2] net: openvswitch: Use struct_size() patchwork-bot+netdevbpf
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=20231017090922.GQ1751252@kernel.org \
--to=horms@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=edumazet@google.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pshelar@ovn.org \
/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.