DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Harton <dharton@cisco.com>
To: dev@dpdk.org
Cc: anatoly.burakov@intel.com, David Harton <dharton@cisco.com>
Subject: [dpdk-dev] [PATCH v2] eal: fix rte_zalloc_socket to zero memory
Date: Sun,  9 Dec 2018 15:11:20 -0500	[thread overview]
Message-ID: <20181209201120.36072-1-dharton@cisco.com> (raw)
In-Reply-To: <20181207222420.9508-1-dharton@cisco.com>

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 <dharton@cisco.com>
---

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

  parent reply	other threads:[~2018-12-09 20:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-07 22:24 [dpdk-dev] [PATCH] " David Harton
2018-12-07 23:41 ` Wiles, Keith
2018-12-07 23:47   ` David Harton (dharton)
2018-12-07 23:51     ` Wiles, Keith
2018-12-07 23:54     ` Wiles, Keith
2018-12-09 19:20 ` Mattias Rönnblom
2018-12-09 20:11 ` David Harton [this message]
2018-12-10 16:21   ` [dpdk-dev] [PATCH v2] " Burakov, Anatoly
2018-12-10 10:26 ` [dpdk-dev] [PATCH] " Bruce Richardson
2018-12-10 10:45   ` Burakov, Anatoly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181209201120.36072-1-dharton@cisco.com \
    --to=dharton@cisco.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).