* [PATCH] lib/lib_eal:fix the pointer 'elem' may be NULL bug
@ 2017-06-28 8:12 RongQiang Xie
2017-06-28 10:06 ` Sergio Gonzalez Monroy
0 siblings, 1 reply; 2+ messages in thread
From: RongQiang Xie @ 2017-06-28 8:12 UTC (permalink / raw)
To: sergio.gonzalez.monroy; +Cc: dev, RongQiang Xie
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();
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] lib/lib_eal:fix the pointer 'elem' may be NULL bug
2017-06-28 8:12 [PATCH] lib/lib_eal:fix the pointer 'elem' may be NULL bug RongQiang Xie
@ 2017-06-28 10:06 ` Sergio Gonzalez Monroy
0 siblings, 0 replies; 2+ messages in thread
From: Sergio Gonzalez Monroy @ 2017-06-28 10:06 UTC (permalink / raw)
To: RongQiang Xie; +Cc: dev
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-28 10:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28 8:12 [PATCH] lib/lib_eal:fix the pointer 'elem' may be NULL bug RongQiang Xie
2017-06-28 10:06 ` Sergio Gonzalez Monroy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.