From: Michal Jastrzebski Date: Tue, 9 May 2017 05:23:29 +0000 (+0200) Subject: app/procinfo: fix xstats by ID on 32-bit X-Git-Tag: spdx-start~3226 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=08dd403dbdd4c38b59904b8930b703505eedefd8;p=dpdk.git app/procinfo: 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: 144523, 144521 Fixes: 7ac16a3660c0 ("app/proc-info: support xstats by ID and by name") Signed-off-by: Michal Jastrzebski Acked-by: Harry van Haaren --- diff --git a/app/proc_info/main.c b/app/proc_info/main.c index 17a1c87494..d4f6a8236e 100644 --- a/app/proc_info/main.c +++ b/app/proc_info/main.c @@ -434,7 +434,7 @@ nic_xstats_by_ids_display(uint8_t port_id, uint64_t *ids, int len) int ret, i; static const char *nic_stats_border = "########################"; - values = malloc(sizeof(values) * len); + values = malloc(sizeof(*values) * len); if (values == NULL) { printf("Cannot allocate memory for xstats\n"); return; @@ -486,7 +486,7 @@ nic_xstats_display(uint8_t port_id) printf("Cannot get xstats count\n"); return; } - values = malloc(sizeof(values) * len); + values = malloc(sizeof(*values) * len); if (values == NULL) { printf("Cannot allocate memory for xstats\n"); return;