DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: fix rte_zalloc_socket to zero memory
@ 2018-12-07 22:24 David Harton
  2018-12-07 23:41 ` Wiles, Keith
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: David Harton @ 2018-12-07 22:24 UTC (permalink / raw)
  To: dev; +Cc: anatoly.burakov, David Harton

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>
---
 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-12-10 16:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-07 22:24 [dpdk-dev] [PATCH] eal: fix rte_zalloc_socket to zero memory 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 ` [dpdk-dev] [PATCH v2] " David Harton
2018-12-10 16:21   ` Burakov, Anatoly
2018-12-10 10:26 ` [dpdk-dev] [PATCH] " Bruce Richardson
2018-12-10 10:45   ` Burakov, Anatoly

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).