From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rcdn-iport-2.cisco.com (rcdn-iport-2.cisco.com [173.37.86.73]) by dpdk.org (Postfix) with ESMTP id 969625F11 for ; Fri, 7 Dec 2018 23:24:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=871; q=dns/txt; s=iport; t=1544221479; x=1545431079; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=W0rUZUUestmT/UZBdS7CfxSWYPUOkr6mYmZcLD1pA3g=; b=eZjROobLVS0F43pSkLfig3aVR+W50NuDslWb1c4B/uwt6qkSiRhx4nTL dlb7z5Qy++M7Ks12CfxkqIE8JeIHo32+equ2YlYPo6sQ3fiJemPCWXz2i D/tB+15QBT+brLyKBXfhINaQJ2/idgz1+lro4ljmG6zJ02+oLuWpR1H13 Y=; X-IronPort-AV: E=Sophos;i="5.56,327,1539648000"; d="scan'208";a="496173643" Received: from rcdn-core-11.cisco.com ([173.37.93.147]) by rcdn-iport-2.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Dec 2018 22:24:38 +0000 Received: from cpp-rtpbld-31.cisco.com (cpp-rtpbld-31.cisco.com [172.18.5.114]) by rcdn-core-11.cisco.com (8.15.2/8.15.2) with ESMTP id wB7MOcJh003310; Fri, 7 Dec 2018 22:24:38 GMT Received: by cpp-rtpbld-31.cisco.com (Postfix, from userid 140087) id 2BC63A02; Fri, 7 Dec 2018 17:24:38 -0500 (EST) From: David Harton To: dev@dpdk.org Cc: anatoly.burakov@intel.com, David Harton Date: Fri, 7 Dec 2018 17:24:20 -0500 Message-Id: <20181207222420.9508-1-dharton@cisco.com> X-Mailer: git-send-email 2.19.1 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-11.cisco.com Subject: [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: Fri, 07 Dec 2018 22:24:39 -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 --- 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); + return new_ptr; } /* -- 2.19.1