From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpbg202.qq.com (smtpbg202.qq.com [184.105.206.29]) by dpdk.org (Postfix) with ESMTP id 6AD627CA9 for ; Thu, 1 Jun 2017 03:24:49 +0200 (CEST) X-QQ-mid: bizesmtp2t1496280286tp5krksb3 Received: from [10.0.30.74] (unknown [106.120.127.10]) by esmtp4.qq.com (ESMTP) with id ; Thu, 01 Jun 2017 09:24:45 +0800 (CST) X-QQ-SSF: 01100000002000F0FG90B00A0000000 X-QQ-FEAT: aMnFv4zHygabx3LGxXptYZxZcdNbqZMO4T6jaoHzjbLc1GzFk5b3FUn1dqsjG 87C2XyLdsQDQIPtLWQVGpzn/XOrcocAJsXzxEuRJciGTPSU1k5DMcNAqkAABIW764X54Kss cTM+yd5cA32IdI/x7a6TNieaczebaRgX4P/3faH0YxD67OD9f/8E4RLYwRlsfVTeVoUujlj YGjnB8G02MFQWhSIjGCHRBvVj3dKraDfmQ8TBh1KS4tHHe+daUfikEIHjgSOSw3ZaAXERG0 4kirCTHQLdeMe4X5nn6AMsrvjE4bf57vW4Xg== X-QQ-GoodBg: 0 From: nickcooper-zhangtonghao Message-Id: Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Date: Thu, 1 Jun 2017 09:24:48 +0800 In-Reply-To: <20170512084220.GB53020@bricha3-MOBL3.ger.corp.intel.com> Cc: dev@dpdk.org To: Bruce Richardson References: <1494569023-7564-1-git-send-email-nic@opencloud.tech> <20170512084220.GB53020@bricha3-MOBL3.ger.corp.intel.com> X-Mailer: Apple Mail (2.3273) X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] memzone: Check socket_id value when creating memzone. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jun 2017 01:24:51 -0000 If that patch is ok, will we apply it to master? Thanks. Nick > On May 12, 2017, at 4:42 PM, Bruce Richardson = wrote: >=20 > 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. >>=20 >> Signed-off-by: Tonghao Zhang >> --- >> lib/librte_eal/common/eal_common_memzone.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >>=20 >> 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; >> } >>=20 >> - if ((socket_id !=3D SOCKET_ID_ANY) && (socket_id >=3D = RTE_MAX_NUMA_NODES)) { >> + if ((socket_id !=3D SOCKET_ID_ANY) && >> + (socket_id >=3D RTE_MAX_NUMA_NODES || socket_id < 0)) { >> rte_errno =3D EINVAL; >> return NULL; >> } >> --=20 >=20 > Looks a sensible thing to do. >=20 > Acked-by: Bruce Richardson >