DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michal Krawczyk <mk@semihalf.com>
To: mw@semihalf.com, gtzalik@amazon.com, matua@amazon.com,
	evgenys@amazon.com
Cc: dev@dpdk.org, Michal Krawczyk <mk@semihalf.com>
Subject: [dpdk-dev] [PATCH 2/2] net/ena: initialize memory in the allocation macros
Date: Tue,  4 Jul 2017 15:51:53 +0200	[thread overview]
Message-ID: <20170704135153.24140-3-mk@semihalf.com> (raw)
In-Reply-To: <20170704135153.24140-1-mk@semihalf.com>

From: Alexander Matushevsky <matua@amazon.com>

Uninitialized memory could cause memory corruption, by indicating
completion of the invalid mbuf.

Fixes: 3d3edc265fc8 ("net/ena: make coherent memory allocation NUMA-aware")
Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
---
 drivers/net/ena/base/ena_plat_dpdk.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index 7eaebf4..71a8c1e 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -207,6 +207,7 @@ typedef uint64_t dma_addr_t;
 		snprintf(z_name, sizeof(z_name),			\
 				"ena_alloc_%d", ena_alloc_cnt++);	\
 		mz = rte_memzone_reserve(z_name, size, node, 0); \
+		memset(mz->addr, 0, size);				\
 		virt = mz->addr;					\
 		phys = mz->phys_addr;					\
 	} while (0)
@@ -219,6 +220,7 @@ typedef uint64_t dma_addr_t;
 		snprintf(z_name, sizeof(z_name),			\
 				"ena_alloc_%d", ena_alloc_cnt++);	\
 		mz = rte_memzone_reserve(z_name, size, node, 0); \
+		memset(mz->addr, 0, size);				\
 		virt = mz->addr;					\
 	} while (0)
 
-- 
2.7.4

  parent reply	other threads:[~2017-07-04 13:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-04 13:51 [dpdk-dev] [PATCH 0/2] ENA PMD memory management fixes Michal Krawczyk
2017-07-04 13:51 ` [dpdk-dev] [PATCH 1/2] net/ena: fix cleanup of the Tx bufs Michal Krawczyk
2017-07-04 13:51 ` Michal Krawczyk [this message]
2017-07-05 10:28 ` [dpdk-dev] [PATCH 0/2] ENA PMD memory management fixes Ferruh Yigit

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=20170704135153.24140-3-mk@semihalf.com \
    --to=mk@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=evgenys@amazon.com \
    --cc=gtzalik@amazon.com \
    --cc=matua@amazon.com \
    --cc=mw@semihalf.com \
    /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).