From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Harton Subject: [PATCH v2] eal: fix rte_zalloc_socket to zero memory Date: Sun, 9 Dec 2018 15:11:20 -0500 Message-ID: <20181209201120.36072-1-dharton@cisco.com> References: <20181207222420.9508-1-dharton@cisco.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: anatoly.burakov@intel.com, David Harton To: dev@dpdk.org Return-path: Received: from rcdn-iport-3.cisco.com (rcdn-iport-3.cisco.com [173.37.86.74]) by dpdk.org (Postfix) with ESMTP id 58D822C2B for ; Sun, 9 Dec 2018 21:11:25 +0100 (CET) In-Reply-To: <20181207222420.9508-1-dharton@cisco.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- v2 Indented if clause lib/librte_eal/common/rte_malloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c index 0da5ad5e8..40a5384ff 100644 --- a/lib/librte_eal/common/rte_malloc.c +++ b/lib/librte_eal/common/rte_malloc.c @@ -74,7 +74,10 @@ 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); + return new_ptr; } /* -- 2.19.1