From: Tonghao Zhang <nic@opencloud.tech>
To: dev@dpdk.org
Cc: Tonghao Zhang <nic@opencloud.tech>
Subject: [PATCH] memzone: Check socket_id value when creating memzone.
Date: Thu, 11 May 2017 23:03:43 -0700 [thread overview]
Message-ID: <1494569023-7564-1-git-send-email-nic@opencloud.tech> (raw)
If the socket_id is invalid (e.g. -2, -3), the
memzone_reserve_aligned_thread_unsafe should return the
EINVAL and not ENOMEM. To avoid it, we should check the
socket_id before calling malloc_heap_alloc.
Signed-off-by: Tonghao Zhang <nic@opencloud.tech>
---
lib/librte_eal/common/eal_common_memzone.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
index 64f4e0a..3026e36 100644
--- a/lib/librte_eal/common/eal_common_memzone.c
+++ b/lib/librte_eal/common/eal_common_memzone.c
@@ -189,7 +189,8 @@
return NULL;
}
- if ((socket_id != SOCKET_ID_ANY) && (socket_id >= RTE_MAX_NUMA_NODES)) {
+ if ((socket_id != SOCKET_ID_ANY) &&
+ (socket_id >= RTE_MAX_NUMA_NODES || socket_id < 0)) {
rte_errno = EINVAL;
return NULL;
}
--
1.8.3.1
next reply other threads:[~2017-05-12 6:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-12 6:03 Tonghao Zhang [this message]
2017-05-12 8:42 ` [PATCH] memzone: Check socket_id value when creating memzone Bruce Richardson
2017-05-17 0:31 ` nickcooper-zhangtonghao
2017-06-01 1:24 ` nickcooper-zhangtonghao
2017-06-05 16:24 ` Thomas Monjalon
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=1494569023-7564-1-git-send-email-nic@opencloud.tech \
--to=nic@opencloud.tech \
--cc=dev@dpdk.org \
/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.