DPDK patches and discussions
 help / color / mirror / Atom feed
From: nickcooper-zhangtonghao <nic@opencloud.tech>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] memzone: Check socket_id value when creating memzone.
Date: Wed, 17 May 2017 08:31:00 +0800	[thread overview]
Message-ID: <64D8B430-8FFD-4F77-B1C4-333023925213@opencloud.tech> (raw)
In-Reply-To: <20170512084220.GB53020@bricha3-MOBL3.ger.corp.intel.com>


> On May 12, 2017, at 4:42 PM, Bruce Richardson <bruce.richardson@intel.com> wrote:
> 
> 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 <mailto:bruce.richardson@intel.com>>


Thanks for your review.

  reply	other threads:[~2017-05-17  0:31 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
2017-05-17  0:31   ` nickcooper-zhangtonghao [this message]
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=64D8B430-8FFD-4F77-B1C4-333023925213@opencloud.tech \
    --to=nic@opencloud.tech \
    --cc=bruce.richardson@intel.com \
    --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 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).