From: Jan Medala Date: Thu, 30 Jun 2016 15:04:58 +0000 (+0200) Subject: net/ena: fix freeing memory using correct API X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0e72dbf2d338df917ab74ad58bf1fceb901865a3;p=dpdk.git net/ena: fix freeing memory using correct API Memory zones should be freed using the proper memzone_free function not rte_free which is for malloc calls. After allocating memzone it's required to zeroize memory in it, so do so before storing the handle for later freeing. Fixes: 9ba7981ec992 ("ena: add communication layer for DPDK") Signed-off-by: Alexander Matushevsky Signed-off-by: Jakub Palider Signed-off-by: Jan Medala --- diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h index b1ed80c702..87c3bf13b4 100644 --- a/drivers/net/ena/base/ena_plat_dpdk.h +++ b/drivers/net/ena/base/ena_plat_dpdk.h @@ -62,7 +62,7 @@ typedef uint64_t dma_addr_t; #endif #define ena_atomic32_t rte_atomic32_t -#define ena_mem_handle_t void * +#define ena_mem_handle_t const struct rte_memzone * #define SZ_256 (256U) #define SZ_4K (4096U) @@ -188,13 +188,15 @@ 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, SOCKET_ID_ANY, 0); \ + memset(mz->addr, 0, size); \ virt = mz->addr; \ phys = mz->phys_addr; \ + handle = mz; \ } while (0) #define ENA_MEM_FREE_COHERENT(dmadev, size, virt, phys, handle) \ ({ ENA_TOUCH(size); ENA_TOUCH(phys); \ ENA_TOUCH(dmadev); \ - rte_free(virt); }) + rte_memzone_free(handle); }) #define ENA_MEM_ALLOC_COHERENT_NODE(dmadev, size, virt, phys, node, dev_node) \ do { \