]> git.droids-corp.org - dpdk.git/commitdiff
net/sfc: fix memory allocation size for cache
authorWeiguo Li <liwg06@foxmail.com>
Tue, 21 Dec 2021 06:41:22 +0000 (14:41 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 18 Feb 2022 15:49:42 +0000 (16:49 +0100)
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 <liwg06@foxmail.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
drivers/net/sfc/sfc_sw_stats.c

index 70259660c03a2ee3133bccbf149c9f297d4ce81b..81f5aa3cc49664ecc83d542def752dc6b782c9b7 100644 (file)
@@ -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;