net/ena/base: initialize memory in the allocation macros
authorAlexander Matushevsky <matua@amazon.com>
Tue, 4 Jul 2017 13:51:53 +0000 (15:51 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 6 Jul 2017 13:00:57 +0000 (15:00 +0200)
Uninitialized memory could cause memory corruption, by indicating
completion of the invalid mbuf.

Fixes: 3d3edc265fc8 ("net/ena: make coherent memory allocation NUMA-aware")
Cc: stable@dpdk.org
Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
drivers/net/ena/base/ena_plat_dpdk.h

index 7eaebf4..71a8c1e 100644 (file)
@@ -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)