From: RongQiang Xie <xie.rongqiang@zte.com.cn>
To: sergio.gonzalez.monroy@intel.com
Cc: dev@dpdk.org, RongQiang Xie <xie.rongqiang@zte.com.cn>
Subject: [PATCH] lib/lib_eal:fix the pointer 'elem' may be NULL bug
Date: Wed, 28 Jun 2017 16:12:35 +0800 [thread overview]
Message-ID: <201706280921.v5S9L22K090306@mse01.zte.com.cn> (raw)
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
next reply other threads:[~2017-06-28 9:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 8:12 RongQiang Xie [this message]
2017-06-28 10:06 ` [PATCH] lib/lib_eal:fix the pointer 'elem' may be NULL bug Sergio Gonzalez Monroy
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=201706280921.v5S9L22K090306@mse01.zte.com.cn \
--to=xie.rongqiang@zte.com.cn \
--cc=dev@dpdk.org \
--cc=sergio.gonzalez.monroy@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 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.