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 8560AADF1 for ; Wed, 8 Jun 2016 21:15:00 +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:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1bAiyZ-0001CG-0c; Wed, 08 Jun 2016 21:17:15 +0200 To: Sergio Gonzalez Monroy , dev@dpdk.org References: <1465398627-35022-1-git-send-email-sergio.gonzalez.monroy@intel.com> From: Olivier Matz Message-ID: <57586EAC.7090304@6wind.com> Date: Wed, 8 Jun 2016 21:14:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0 MIME-Version: 1.0 In-Reply-To: <1465398627-35022-1-git-send-email-sergio.gonzalez.monroy@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] mempool: fix local cache initialization 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: Wed, 08 Jun 2016 19:15:00 -0000 Hi Sergio, Good catch, thanks. The patch looks ok, just few comments on the commit log: On 06/08/2016 05:10 PM, Sergio Gonzalez Monroy wrote: > The mempool local cache is not being initialize properly leading to 'initialize' -> 'initialized' ? and maybe 'is not being' -> 'was not' ? > undefined behavior in cases where the allocated memory was used and left > with data. > > Fixes: af75078fece3 ("first public release") I think it fixes this one instead: 213af31e0960 ("mempool: reduce structure size if no cache needed") > > Signed-off-by: Sergio Gonzalez Monroy > --- > 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 b54de43..216514c 100644 > --- a/lib/librte_mempool/rte_mempool.c > +++ b/lib/librte_mempool/rte_mempool.c > @@ -787,7 +787,7 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size, > > /* init the mempool structure */ > mp = mz->addr; > - memset(mp, 0, sizeof(*mp)); > + memset(mp, 0, MEMPOOL_HEADER_SIZE(mp, cache_size)); > ret = snprintf(mp->name, sizeof(mp->name), "%s", name); > if (ret < 0 || ret >= (int)sizeof(mp->name)) { > rte_errno = ENAMETOOLONG; >