From: Bruce Richardson <bruce.richardson@intel.com>
To: Tonghao Zhang <nic@opencloud.tech>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] memzone: Check socket_id value when creating memzone.
Date: Fri, 12 May 2017 09:42:20 +0100 [thread overview]
Message-ID: <20170512084220.GB53020@bricha3-MOBL3.ger.corp.intel.com> (raw)
In-Reply-To: <1494569023-7564-1-git-send-email-nic@opencloud.tech>
On Thu, May 11, 2017 at 11:03:43PM -0700, Tonghao Zhang wrote:
> 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;
> }
> --
Looks a sensible thing to do.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
next prev parent reply other threads:[~2017-05-12 8:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-12 6:03 Tonghao Zhang
2017-05-12 8:42 ` Bruce Richardson [this message]
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=20170512084220.GB53020@bricha3-MOBL3.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=nic@opencloud.tech \
/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).