From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by dpdk.org (Postfix) with ESMTP id 6FB372C02 for ; Sun, 9 Dec 2018 20:20:29 +0100 (CET) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id EEFD44000C for ; Sun, 9 Dec 2018 20:20:28 +0100 (CET) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id D91094000F; Sun, 9 Dec 2018 20:20:28 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on bernadotte.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=ALL_TRUSTED,AWL autolearn=disabled version=3.4.1 X-Spam-Score: -0.9 Received: from [192.168.1.59] (host-90-232-138-252.mobileonline.telia.com [90.232.138.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 6EBAA4000C; Sun, 9 Dec 2018 20:20:26 +0100 (CET) To: David Harton , dev@dpdk.org Cc: anatoly.burakov@intel.com References: <20181207222420.9508-1-dharton@cisco.com> From: =?UTF-8?Q?Mattias_R=c3=b6nnblom?= Message-ID: <1f81a7b2-749c-e384-540c-741bf2a3162d@ericsson.com> Date: Sun, 9 Dec 2018 20:20:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181207222420.9508-1-dharton@cisco.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [dpdk-dev] [PATCH] eal: fix rte_zalloc_socket to zero memory 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: Sun, 09 Dec 2018 19:20:29 -0000 On 2018-12-07 23:24, David Harton wrote: > The zalloc and calloc functions do not actually zero the memory. > Added memset to rte_zmalloc_socket() so allocated memory is cleared. > > Signed-off-by: David Harton > --- > lib/librte_eal/common/rte_malloc.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c > index 0da5ad5e8..be382e534 100644 > --- a/lib/librte_eal/common/rte_malloc.c > +++ b/lib/librte_eal/common/rte_malloc.c > @@ -74,7 +74,9 @@ rte_malloc(const char *type, size_t size, unsigned align) > void * > rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket) > { > - return rte_malloc_socket(type, size, align, socket); > + void *new_ptr = rte_malloc_socket(type, size, align, socket); > + if (new_ptr) memset(new_ptr, 0, size); Maybe it would be worth to have a likely() here. > + return new_ptr; > } > > /* >