From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=904; q=dns/txt; s=iport; t=1544386285; x=1545595885; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KsP2MXbKtiY+tBfYRQrKXJp2fUJ8OC7eGki+7g4J13k=; b=gV3Vjmt8mG133SXUtQR+YBMZsS+ScbpdgNudDczS54HTZ8lC61Gx8MMT yO1xYW0GWM6sfKPwL0P+qYdrw1ajpX4XJrghqLvG0gKz5zhy0/TKAMk54 /tpO5K+W+QSnRHrajyiXhdfKf4JyHATTcSkdLEkwEYsDE6Y1Fd7WCmO7p s=; X-IronPort-AV: E=Sophos;i="5.56,335,1539648000"; d="scan'208";a="483127155" Received: from rcdn-core-12.cisco.com ([173.37.93.148]) by rcdn-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Dec 2018 20:11:24 +0000 Received: from cpp-rtpbld-31.cisco.com (cpp-rtpbld-31.cisco.com [172.18.5.114]) by rcdn-core-12.cisco.com (8.15.2/8.15.2) with ESMTP id wB9KBNr4002565; Sun, 9 Dec 2018 20:11:24 GMT Received: by cpp-rtpbld-31.cisco.com (Postfix, from userid 140087) id C046E97E; Sun, 9 Dec 2018 15:11:23 -0500 (EST) From: David Harton To: dev@dpdk.org Cc: anatoly.burakov@intel.com, David Harton Date: Sun, 9 Dec 2018 15:11:20 -0500 Message-Id: <20181209201120.36072-1-dharton@cisco.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181207222420.9508-1-dharton@cisco.com> References: <20181207222420.9508-1-dharton@cisco.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Outbound-SMTP-Client: 172.18.5.114, cpp-rtpbld-31.cisco.com X-Outbound-Node: rcdn-core-12.cisco.com Subject: [dpdk-dev] [PATCH v2] 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 20:11:25 -0000 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