DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
To: RongQiang Xie <xie.rongqiang@zte.com.cn>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] lib/lib_eal:fix the pointer 'elem' may be NULL bug
Date: Wed, 28 Jun 2017 11:06:34 +0100	[thread overview]
Message-ID: <b20c41e3-b0b3-9c63-ad41-d4e27dd3474f@intel.com> (raw)
In-Reply-To: <201706280921.v5S9L22K090306@mse01.zte.com.cn>

On 28/06/2017 09:12, RongQiang Xie wrote:
> Signed-off-by: RongQiang Xie <xie.rongqiang@zte.com.cn>
> ---
>   lib/librte_eal/common/eal_common_memzone.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>   mode change 100644 => 100755 lib/librte_eal/common/eal_common_memzone.c
>
> diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
> old mode 100644
> new mode 100755
> index 3026e36..8ea781b
> --- a/lib/librte_eal/common/eal_common_memzone.c
> +++ b/lib/librte_eal/common/eal_common_memzone.c
> @@ -238,6 +238,12 @@
>   	}
>   
>   	const struct malloc_elem *elem = malloc_elem_from_data(mz_addr);
> +	
> +	if (elem == NULL) {
> +	    RTE_LOG(ERR, EAL, "%s(): Cannot malloc elem from data \n", __func__);
> +		rte_errno = ENOSPC;
> +		return NULL;
> +	}
>   
>   	/* fill the zone in config */
>   	mz = get_next_free_memzone();

Hi,

Could you elaborate how do you trigger this error?

The only way you are getting NULL from malloc_elem_from_data is:
A) data is NULL, which cannot be the case as we previously check for it
B) cookies failure id you have DEBUG enabled, otherwise elem would have 
to be NULL

Thanks,
Sergio

      reply	other threads:[~2017-06-28 10:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28  8:12 RongQiang Xie
2017-06-28 10:06 ` Sergio Gonzalez Monroy [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=b20c41e3-b0b3-9c63-ad41-d4e27dd3474f@intel.com \
    --to=sergio.gonzalez.monroy@intel.com \
    --cc=dev@dpdk.org \
    --cc=xie.rongqiang@zte.com.cn \
    /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).