From b0fed38467713807ac03d50ae7c02ef4c320470a Mon Sep 17 00:00:00 2001 From: Weiguo Li Date: Tue, 21 Dec 2021 14:41:22 +0800 Subject: [PATCH] net/sfc: fix memory allocation size for cache The size of unit cache should be sizeof(**cache) instead of sizeof(*cache). Memory reallocation is inadequate by sizeof(*cache) for the platform whose size of pointer is 32-bits. Found by coccinelle (see https://coccinelle.gitlabpages.inria.fr/website) script. Fixes: 63abf8d29225 ("net/sfc: support SW stats groups") Cc: stable@dpdk.org Signed-off-by: Weiguo Li Reviewed-by: Andrew Rybchenko --- drivers/net/sfc/sfc_sw_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c index 70259660c0..81f5aa3cc4 100644 --- a/drivers/net/sfc/sfc_sw_stats.c +++ b/drivers/net/sfc/sfc_sw_stats.c @@ -777,7 +777,7 @@ sfc_sw_xstats_configure(struct sfc_adapter *sa) memset(*reset_vals, 0, nb_supported * sizeof(**reset_vals)); - *cache = rte_realloc(*cache, cache_count * sizeof(*cache), 0); + *cache = rte_realloc(*cache, cache_count * sizeof(**cache), 0); if (*cache == NULL) { rc = ENOMEM; goto fail_cache; -- 2.39.5