Re: [PATCH 0/2] net/smc: Adjustments for two function implementations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 2023/12/31 22:55, Markus Elfring wrote:
From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux