From 881acd6ed6138b7be6d66cff5f02cb3b917d1cb8 Mon Sep 17 00:00:00 2001 From: Michal Jastrzebski Date: Tue, 9 May 2017 07:22:13 +0200 Subject: [PATCH 1/1] ethdev: fix xstats by ID on 32-bit Coverity reported that an argument for sizeof was used improperly. We should allocate memory for value size that pointer points to, instead of pointer size itself. Coverity issue: 144522 Fixes: 79c913a42f0e ("ethdev: retrieve xstats by ID") Signed-off-by: Michal Jastrzebski Acked-by: Harry van Haaren --- lib/librte_ether/rte_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 8cf8b65d2a..83898a8f75 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1714,7 +1714,7 @@ rte_eth_xstats_get_by_id(uint8_t port_id, const uint64_t *ids, uint64_t *values, size = rte_eth_xstats_get_by_id(port_id, NULL, NULL, 0); - values_copy = malloc(sizeof(values_copy) * size); + values_copy = malloc(sizeof(*values_copy) * size); if (!values_copy) { RTE_PMD_DEBUG_TRACE( "ERROR: can't allocate memory for values_copy\n"); -- 2.20.1