From: "Min Hu (Connor)" <humin29@huawei.com>
To: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "Yigit, Ferruh" <ferruh.yigit@intel.com>
Subject: Re: [dpdk-dev] [PATCH] pipeline: fix deallocate null pointer
Date: Thu, 22 Apr 2021 17:36:37 +0800 [thread overview]
Message-ID: <4ba72d50-b05f-ddc1-46e6-83426c972bcf@huawei.com> (raw)
In-Reply-To: <DM6PR11MB27968DE236A750EC2643D377EB469@DM6PR11MB2796.namprd11.prod.outlook.com>
在 2021/4/22 16:36, Dumitrescu, Cristian 写道:
>
>
>> -----Original Message-----
>> From: Min Hu (Connor) <humin29@huawei.com>
>> Sent: Thursday, April 22, 2021 7:39 AM
>> To: dev@dpdk.org
>> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Dumitrescu, Cristian
>> <cristian.dumitrescu@intel.com>
>> Subject: [PATCH] pipeline: fix deallocate null pointer
>>
>> From: HongBo Zheng <zhenghongbo3@huawei.com>
>>
>> Fix deallocate null pointer in instruction_config, while
>> pointer 'data' or 'instr' may be null.
>>
>> Fixes: a1711f948dbf ("pipeline: add SWX Rx and extract instructions")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: HongBo Zheng <zhenghongbo3@huawei.com>
>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>> ---
>> lib/librte_pipeline/rte_swx_pipeline.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/librte_pipeline/rte_swx_pipeline.c
>> b/lib/librte_pipeline/rte_swx_pipeline.c
>> index 4455d91..6084635 100644
>> --- a/lib/librte_pipeline/rte_swx_pipeline.c
>> +++ b/lib/librte_pipeline/rte_swx_pipeline.c
>> @@ -8015,8 +8015,10 @@ instruction_config(struct rte_swx_pipeline *p,
>> return 0;
>>
>> error:
>> - free(data);
>> - free(instr);
>> + if (data)
>> + free(data);
>> + if (instr)
>> + free(instr);
>> return err;
>> }
>>
>> --
>> 2.7.4
>
> Hi,
>
> NACK.
>
> Thanks for the patch, but the tests for data and instr being non-NULL before calling free are not required, because:
> 1. Both data and instr are initialized to NULL.
> 2. free(NULL) is supported.
>
Agreed, thanks Cristian, this patch can be abandoned.
> Regards,
> Cristian
> .
>
prev parent reply other threads:[~2021-04-22 9:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-22 6:38 Min Hu (Connor)
2021-04-22 8:36 ` Dumitrescu, Cristian
2021-04-22 9:36 ` Min Hu (Connor) [this message]
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=4ba72d50-b05f-ddc1-46e6-83426c972bcf@huawei.com \
--to=humin29@huawei.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@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;
as well as URLs for NNTP newsgroup(s).