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 <michalx.k.jastrzebski@intel.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
This commit is contained in:
parent
70361cb13d
commit
881acd6ed6
@ -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);
|
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) {
|
if (!values_copy) {
|
||||||
RTE_PMD_DEBUG_TRACE(
|
RTE_PMD_DEBUG_TRACE(
|
||||||
"ERROR: can't allocate memory for values_copy\n");
|
"ERROR: can't allocate memory for values_copy\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user