From: Bruce Richardson Date: Thu, 17 Feb 2022 15:02:39 +0000 (+0000) Subject: distributor: fix potential overflow X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9699b09803b799ddc11abedffb17af059c992e9a;p=dpdk.git distributor: fix potential overflow Coverity flags the fact that the tag values used in distributor are 32-bit, which means that when we use bit-manipulation to convert a tag match/no-match to a bit in an array, we need to typecast to a 64-bit type before shifting past 32 bits. Coverity issue: 375808 Fixes: 08ccf3faa6a9 ("distributor: new packet distributor library") Cc: stable@dpdk.org Signed-off-by: Bruce Richardson Acked-by: David Hunt --- diff --git a/lib/distributor/rte_distributor_single.c b/lib/distributor/rte_distributor_single.c index de90aa8bb5..2c77ac454a 100644 --- a/lib/distributor/rte_distributor_single.c +++ b/lib/distributor/rte_distributor_single.c @@ -245,8 +245,7 @@ rte_distributor_process_single(struct rte_distributor_single *d, * worker given by the bit-position */ for (i = 0; i < d->num_workers; i++) - match |= (!(d->in_flight_tags[i] ^ new_tag) - << i); + match |= ((uint64_t)!(d->in_flight_tags[i] ^ new_tag) << i); /* Only turned-on bits are considered as match */ match &= d->in_flight_bitmask;