diff --git a/include/ipv4.h b/include/ipv4.h index cf95882f2..394272bbb 100644 --- a/include/ipv4.h +++ b/include/ipv4.h @@ -100,7 +100,7 @@ extern rte_spinlock_t ip4_stats_lock; #define IP4_UPD_PO_STATS(field, val) \ do { \ rte_spinlock_lock(&ip4_stats_lock); \ - __IP4_ADD_STATS(field##pkts, (val)); \ + __IP4_ADD_STATS(field##pkts, (1)); \ __IP4_ADD_STATS(field##octets, (val)); \ rte_spinlock_unlock(&ip4_stats_lock); \ } while (0) diff --git a/include/parser/utils.h b/include/parser/utils.h index 0ea27f1a5..7f65f6ef6 100644 --- a/include/parser/utils.h +++ b/include/parser/utils.h @@ -31,8 +31,6 @@ static inline void* xmalloc(uint32_t sz) { void *mem = rte_zmalloc("cfgfile", sz, RTE_CACHE_LINE_SIZE); - if (mem) - memset(mem, 0, sz); return mem; } diff --git a/src/iftraf.c b/src/iftraf.c index a03277402..c760822f2 100644 --- a/src/iftraf.c +++ b/src/iftraf.c @@ -477,7 +477,6 @@ static void inline iftraf_tlb_add(struct iftraf_pkt *param) return; } - memset(entry, 0, sizeof(struct iftraf_entry)); entry->af = param->af; entry->cid = param->cid; entry->devid = param->devid; @@ -578,7 +577,6 @@ static void inline iftraf_iftlb_add(struct iftraf_pkt *param) return; } - memset(entry, 0, sizeof(struct iftraf_entry)); entry->af = param->af; entry->cid = param->cid; entry->devid = param->devid; diff --git a/src/parser.c b/src/parser.c index 6ac4313e2..11491f7eb 100644 --- a/src/parser.c +++ b/src/parser.c @@ -392,9 +392,9 @@ void *set_value(vector_t tokens) str = VECTOR_SLOT(tokens, i); len += strlen(str); if (!alloc) - alloc = (char *) MALLOC(sizeof(char *) * (len + 1)); + alloc = (char *) MALLOC(sizeof(char) * (len + 1)); else { - alloc = REALLOC(alloc, sizeof(char *) * (len + 1)); + alloc = REALLOC(alloc, sizeof(char) * (len + 1)); tmp = VECTOR_SLOT(tokens, i - 1); if ( *str != '"' && *tmp != '"') strncat(alloc, " ", 1);