From: Julien Panis <jpanis@baylibre.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Russell King" <linux@armlinux.org.uk>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
"Simon Horman" <horms@kernel.org>, "Andrew Lunn" <andrew@lunn.ch>,
"Ratheesh Kannoth" <rkannoth@marvell.com>,
"Naveen Mamindlapalli" <naveenm@marvell.com>,
danishanwar@ti.com, yuehaibing@huawei.com, rogerq@kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, linux-media@vger.kernel.org,
dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org
Subject: Re: [PATCH net-next v8 2/3] net: ethernet: ti: Add desc_infos member to struct k3_cppi_desc_pool
Date: Wed, 10 Apr 2024 10:36:16 +0200 [thread overview]
Message-ID: <6f356fec-4384-4367-8812-a18b71156116@baylibre.com> (raw)
In-Reply-To: <20240409173948.66abe6fa@kernel.org>
On 4/10/24 02:39, Jakub Kicinski wrote:
> On Mon, 08 Apr 2024 11:38:03 +0200 Julien Panis wrote:
>> goto gen_pool_create_fail;
>> }
>>
>> + pool->desc_infos = kcalloc(pool->num_desc,
>> + sizeof(*pool->desc_infos), GFP_KERNEL);
>> + if (!pool->desc_infos) {
>> + ret = -ENOMEM;
>> + dev_err(pool->dev,
>> + "pool descriptor infos alloc failed %d\n", ret);
> Please don't add errors on mem alloc failures. They just bloat the
> kernel, there will be a rather large OOM splat in the logs if GFP_KERNEL
> allocation fails.
>
>> + kfree_const(pool_name);
>> + goto gen_pool_desc_infos_alloc_fail;
>> + }
>> +
>> pool->gen_pool->name = pool_name;
> If you add the new allocation after this line, I think you wouldn't
> have to free pool_name under the if () explicitly.
Hello Jakub,
Thanks for these suggestions, I'll implement them in next version.
Also, about mem alloc failures, shouldn't we free 'pool' on kstrdup_const()
error at the beginning of k3_cppi_desc_pool_create_name() ?
I mean, it's not visible in my patch but I now wonder if this was done
properly even before I modify the file.
Currently, we have:
pool_name = kstrdup_const(...)
if (!pool_name)
return ERR_PTR(ret);
Shouldnt we have instead:
pool_name = kstrdup_const(...)
if (!pool_name)
goto gen_pool_create_fail;
(maybe label to be renamed)
...so that 'pool' can be freed before returning error.
Julien
next prev parent reply other threads:[~2024-04-10 8:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-08 9:38 [PATCH net-next v8 0/3] Add minimal XDP support to TI AM65 CPSW Ethernet driver Julien Panis
2024-04-08 9:38 ` [PATCH net-next v8 1/3] net: ethernet: ti: Add accessors for struct k3_cppi_desc_pool members Julien Panis
2024-04-08 9:38 ` [PATCH net-next v8 2/3] net: ethernet: ti: Add desc_infos member to struct k3_cppi_desc_pool Julien Panis
2024-04-10 0:39 ` Jakub Kicinski
2024-04-10 8:36 ` Julien Panis [this message]
2024-04-10 13:24 ` Jakub Kicinski
2024-04-08 9:38 ` [PATCH net-next v8 3/3] net: ethernet: ti: am65-cpsw: Add minimal XDP support Julien Panis
2024-04-10 0:49 ` Jakub Kicinski
2024-04-10 14:02 ` Julien Panis
2024-04-10 15:02 ` Jakub Kicinski
2024-04-12 13:56 ` Julien Panis
2024-04-09 23:51 ` [PATCH net-next v8 0/3] Add minimal XDP support to TI AM65 CPSW Ethernet driver Jacob Keller
2024-04-12 14:01 ` Julien Panis
2024-04-12 23:38 ` Keller, Jacob E
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=6f356fec-4384-4367-8812-a18b71156116@baylibre.com \
--to=jpanis@baylibre.com \
--cc=andrew@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=christian.koenig@amd.com \
--cc=daniel@iogearbox.net \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=naveenm@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rkannoth@marvell.com \
--cc=rogerq@kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=yuehaibing@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
all inboxes | Powered by JetHome®