From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id 843C98DA0 for ; Mon, 17 Aug 2015 10:55:45 +0200 (CEST) Received: from was59-1-82-226-113-214.fbx.proxad.net ([82.226.113.214] helo=[192.168.0.10]) by mail.droids-corp.org with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1ZRGHl-0002JJ-LX; Mon, 17 Aug 2015 11:00:57 +0200 Message-ID: <55D1A187.7080802@6wind.com> Date: Mon, 17 Aug 2015 10:55:35 +0200 From: Olivier MATZ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: Dan Aloni References: <1439752099-23090-1-git-send-email-dan@kernelim.com> In-Reply-To: <1439752099-23090-1-git-send-email-dan@kernelim.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] mempool: fix the inverted pg_num check on create X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2015 08:55:45 -0000 Hi, On 08/16/2015 09:08 PM, Dan Aloni wrote: > The rest of the code expects pg_num <= RTE_DIM(mp->elt_pa). > > Signed-off-by: Dan Aloni > --- > lib/librte_mempool/rte_mempool.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c > index 8e185c545479..edcfa8bf9cb1 100644 > --- a/lib/librte_mempool/rte_mempool.c > +++ b/lib/librte_mempool/rte_mempool.c > @@ -461,7 +461,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size, > } > > /* Check that pg_num and pg_shift parameters are valid. */ > - if (pg_num < RTE_DIM(mp->elt_pa) || pg_shift > MEMPOOL_PG_SHIFT_MAX) { > + if (pg_num > RTE_DIM(mp->elt_pa) || pg_shift > MEMPOOL_PG_SHIFT_MAX) { > rte_errno = EINVAL; > return NULL; > } > Could you give some details about the conditions to reproduce and the consequences of the issue? >>From what I see, RTE_DIM(mp->elt_pa) is always 1: #define MEMPOOL_PG_NUM_DEFAULT 1 struct rte_mempool { ... phys_addr_t elt_pa[MEMPOOL_PG_NUM_DEFAULT]; } __rte_cache_aligned; >>From rte_mempool_xmem_create() documentation, pg_num gives the size of the paddr array, which is allocated by the caller. So I think there is no issue here. Regards, Olivier