mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bragatheswaran Manickavel <bragathemanick0908@gmail.com>
To: Wojciech Drewek <wojciech.drewek@intel.com>,
	shannon.nelson@amd.com, brett.creeley@amd.com,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] amd/pds_core: core: No need for Null pointer check before kfree
Date: Wed, 25 Oct 2023 17:09:21 +0530	[thread overview]
Message-ID: <ad7350d9-873b-4e79-8941-1fe684bb13a2@gmail.com> (raw)
In-Reply-To: <74296600-6d91-4353-a9f6-fdb1ed724a59@intel.com>

Thanks Shannon!

On 25/10/23 14:52, Wojciech Drewek wrote:
>
> On 24.10.2023 20:20, 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@gmail.com>
>> ---
> Thanks for the patch!
> One nit, you're missing a target tag. It should be [PATCH net-next] since this not a fix IMO.
> Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Hi Wojciech,
Will take care of this next time. Thanks!
>>   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));
>>   }

  reply	other threads:[~2023-10-25 11:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 18:20 Bragatheswaran Manickavel
2023-10-24 20:58 ` Nelson, Shannon
2023-10-25  9:22 ` Wojciech Drewek
2023-10-25 11:39   ` Bragatheswaran Manickavel [this message]
2023-10-25  9:40 ` patchwork-bot+netdevbpf

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=ad7350d9-873b-4e79-8941-1fe684bb13a2@gmail.com \
    --to=bragathemanick0908@gmail.com \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shannon.nelson@amd.com \
    --cc=wojciech.drewek@intel.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

Powered by JetHome