patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] distributor: fix potential overflow bug
@ 2022-02-17 15:02 Bruce Richardson
  2022-02-17 15:24 ` David Hunt
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2022-02-17 15:02 UTC (permalink / raw)
  To: dev; +Cc: David Hunt, Bruce Richardson, stable

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 <bruce.richardson@intel.com>
---
 lib/distributor/rte_distributor_single.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/distributor/rte_distributor_single.c b/lib/distributor/rte_distributor_single.c
index b653620688..60ca86152f 100644
--- a/lib/distributor/rte_distributor_single.c
+++ b/lib/distributor/rte_distributor_single.c
@@ -247,8 +247,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;
-- 
2.32.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-27 18:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 15:02 [PATCH] distributor: fix potential overflow bug Bruce Richardson
2022-02-17 15:24 ` David Hunt
2022-02-27 18:07   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).