From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: kadlec@netfilter.org, roopa@nvidia.com, razor@blackwall.org,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, dsahern@kernel.org, krzk@kernel.org,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
bridge@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next 4/5] netfilter: iptables: Use kmemdup_array() instead of kmemdup() for multiple allocation
Date: Wed, 28 Aug 2024 10:42:08 +0200 [thread overview]
Message-ID: <Zs7i4PSQQEI0tHN6@calendula> (raw)
In-Reply-To: <20240828071004.1245213-5-ruanjinjie@huawei.com>
On Wed, Aug 28, 2024 at 03:10:03PM +0800, Jinjie Ruan wrote:
> Let the kmemdup_array() take care about multiplication and possible
> overflows.
No patch for net/ipv6/netfilter/ip6_tables.c?
We have yet another code copy & paste there.
BTW, could you collapse all these patches for netfilter in one single
patch?
Thanks.
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
> net/ipv4/netfilter/ip_tables.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
> index fe89a056eb06..096bfef472b1 100644
> --- a/net/ipv4/netfilter/ip_tables.c
> +++ b/net/ipv4/netfilter/ip_tables.c
> @@ -1767,7 +1767,7 @@ int ipt_register_table(struct net *net, const struct xt_table *table,
> goto out_free;
> }
>
> - ops = kmemdup(template_ops, sizeof(*ops) * num_ops, GFP_KERNEL);
> + ops = kmemdup_array(template_ops, num_ops, sizeof(*ops), GFP_KERNEL);
> if (!ops) {
> ret = -ENOMEM;
> goto out_free;
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2024-08-28 8:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 7:09 [PATCH -next 0/5] net: Use kmemdup_array() instead of kmemdup() for multiple allocation Jinjie Ruan
2024-08-28 7:07 ` Jinjie Ruan
2024-08-28 7:10 ` [PATCH -next 1/5] nfc: core: " Jinjie Ruan
2024-08-28 7:10 ` [PATCH -next 2/5] netfilter: " Jinjie Ruan
2024-08-28 7:10 ` [PATCH -next 3/5] netfilter: arptables: " Jinjie Ruan
2024-08-28 7:10 ` [PATCH -next 4/5] netfilter: iptables: " Jinjie Ruan
2024-08-28 8:42 ` Pablo Neira Ayuso [this message]
2024-08-28 14:51 ` Pablo Neira Ayuso
2024-08-28 7:10 ` [PATCH -next 5/5] netfilter: nf_nat: " Jinjie Ruan
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=Zs7i4PSQQEI0tHN6@calendula \
--to=pablo@netfilter.org \
--cc=bridge@lists.linux.dev \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kadlec@netfilter.org \
--cc=krzk@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=roopa@nvidia.com \
--cc=ruanjinjie@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox