[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <93033352-4b9c-bf52-1920-6ccf07926a21@linux.alibaba.com>
Date: Tue, 2 Jan 2024 16:13:09 +0800
From: Wen Gu <guwen@...ux.alibaba.com>
To: Markus Elfring <Markus.Elfring@....de>, linux-s390@...r.kernel.org,
netdev@...r.kernel.org, kernel-janitors@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>, "D. Wythe"
<alibuda@...ux.alibaba.com>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Jan Karcher <jaka@...ux.ibm.com>,
Paolo Abeni <pabeni@...hat.com>, Tony Lu <tonylu@...ux.alibaba.com>,
Wenjia Zhang <wenjia@...ux.ibm.com>
Subject: Re: [PATCH 0/2] net/smc: Adjustments for two function implementations
On 2023/12/31 22:55, Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Sun, 31 Dec 2023 15:48:45 +0100
>
> A few update suggestions were taken into account
> from static source code analysis.
>
> Markus Elfring (2):
> Return directly after a failed kzalloc() in smc_fill_gid_list()
> Improve exception handling in smc_llc_cli_add_link_invite()
>
> net/smc/af_smc.c | 2 +-
> net/smc/smc_llc.c | 15 +++++++--------
> 2 files changed, 8 insertions(+), 9 deletions(-)
>
> --
> 2.43.0
Hi Markus. I see you want to fix the kfree(NULL) issues in these two patches.
But I am wondering if this is necessary, since kfree() can handle NULL correctly.
/**
* kfree - free previously allocated memory
* @object: pointer returned by kmalloc() or kmem_cache_alloc()
*
* If @object is NULL, no operation is performed.
*/
void kfree(const void *object)
{
struct folio *folio;
struct slab *slab;
struct kmem_cache *s;
trace_kfree(_RET_IP_, object);
if (unlikely(ZERO_OR_NULL_PTR(object)))
return;
folio = virt_to_folio(object);
if (unlikely(!folio_test_slab(folio))) {
free_large_kmalloc(folio, (void *)object);
return;
}
slab = folio_slab(folio);
s = slab->slab_cache;
__kmem_cache_free(s, (void *)object, _RET_IP_);
}
EXPORT_SYMBOL(kfree);
Thanks,
Wen Gu
Powered by blists - more mailing lists