From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpbguseast2.qq.com (smtpbguseast2.qq.com [54.204.34.130]) by dpdk.org (Postfix) with ESMTP id 5DD43292D for ; Wed, 17 May 2017 02:31:04 +0200 (CEST) X-QQ-mid: bizesmtp1t1494981060tcrivw4lz Received: from [10.0.30.74] (unknown [106.120.127.10]) by esmtp4.qq.com (ESMTP) with id ; Wed, 17 May 2017 08:30:59 +0800 (CST) X-QQ-SSF: 01100000002000F0FG80B00A0000000 X-QQ-FEAT: 5t7Y1p3pIzEWCZAng0Tb4xiGgx2NDs0oYB+Ib0N9M1saNtKoLASKLT4vn0aW3 +Yh+D14/EY7NBrsmy+5acP1iMQoFlzmhgIg3jPMR93+F1zRjbunxHO792v9A3CB6wSQSzl/ y8vMbNKxgHBx4QMLU4ncyrJ8pZwpCx7PFNqb7Vd8lbyhUS5JH9Eyrvm4l4/ddPKu1jK2/ZR RgQ7GBqryoTikNxa+N9gOREAKcmnDoqC1P3g2wQgXXY3++aj9fRQB8LNKWqkI3CO/225DW/ pDWZzJMrmF3B5LGNL/n2AlX/o= X-QQ-GoodBg: 0 From: nickcooper-zhangtonghao Message-Id: <64D8B430-8FFD-4F77-B1C4-333023925213@opencloud.tech> Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Date: Wed, 17 May 2017 08:31:00 +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: Wed, 17 May 2017 00:31:06 -0000 > 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 > Thanks for your review.