DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
To: "Min Hu (Connor)" <humin29@huawei.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 08:36:21 +0000	[thread overview]
Message-ID: <DM6PR11MB27968DE236A750EC2643D377EB469@DM6PR11MB2796.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1619073510-58316-1-git-send-email-humin29@huawei.com>



> -----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.

Regards,
Cristian

  reply	other threads:[~2021-04-22  8: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 [this message]
2021-04-22  9:36   ` Min Hu (Connor)

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=DM6PR11MB27968DE236A750EC2643D377EB469@DM6PR11MB2796.namprd11.prod.outlook.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=humin29@huawei.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).