lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c50f2d3d-98dd-4194-9080-81298dd0563c@amd.com>
Date:   Tue, 24 Oct 2023 13:58:00 -0700
From:   "Nelson, Shannon" <shannon.nelson@....com>
To:     Bragatheswaran Manickavel <bragathemanick0908@...il.com>,
        brett.creeley@....com, davem@...emloft.net, edumazet@...gle.com,
        kuba@...nel.org, pabeni@...hat.com
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] amd/pds_core: core: No need for Null pointer check before
 kfree

On 10/24/2023 11:20 AM, Bragatheswaran Manickavel wrote:
> 
> kfree()/vfree() internally perform NULL check on the
> pointer handed to it and take no action if it indeed is
> NULL. Hence there is no need for a pre-check of the memory
> pointer before handing it to kfree()/vfree().
> 
> Issue reported by ifnullfree.cocci Coccinelle semantic
> patch script.
> 
> Signed-off-by: Bragatheswaran Manickavel <bragathemanick0908@...il.com>

Thanks -sln

Reviewed-by: Shannon Nelson <shannon.nelson@....com>


> ---
>   drivers/net/ethernet/amd/pds_core/core.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/amd/pds_core/core.c b/drivers/net/ethernet/amd/pds_core/core.c
> index 2a8643e167e1..0d2091e9eb28 100644
> --- a/drivers/net/ethernet/amd/pds_core/core.c
> +++ b/drivers/net/ethernet/amd/pds_core/core.c
> @@ -152,11 +152,8 @@ void pdsc_qcq_free(struct pdsc *pdsc, struct pdsc_qcq *qcq)
>                  dma_free_coherent(dev, qcq->cq_size,
>                                    qcq->cq_base, qcq->cq_base_pa);
> 
> -       if (qcq->cq.info)
> -               vfree(qcq->cq.info);
> -
> -       if (qcq->q.info)
> -               vfree(qcq->q.info);
> +       vfree(qcq->cq.info);
> +       vfree(qcq->q.info);
> 
>          memset(qcq, 0, sizeof(*qcq));
>   }
> --
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ