All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: David Hunt <david.hunt@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	stable@dpdk.org
Subject: [PATCH] distributor: fix potential overflow bug
Date: Thu, 17 Feb 2022 15:02:39 +0000	[thread overview]
Message-ID: <20220217150239.69876-1-bruce.richardson@intel.com> (raw)

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


             reply	other threads:[~2022-02-17 15:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 15:02 Bruce Richardson [this message]
2022-02-17 15:24 ` [PATCH] distributor: fix potential overflow bug David Hunt
2022-02-27 18:07   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220217150239.69876-1-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.