From: Steve Yang <stevex.yang@intel.com>
To: dev@dpdk.org
Cc: beilei.xing@intel.com, Steve Yang <stevex.yang@intel.com>
Subject: [PATCH v1] net/i40e: fix coverity issue
Date: Wed, 23 Feb 2022 06:41:47 +0000 [thread overview]
Message-ID: <20220223064147.3512888-1-stevex.yang@intel.com> (raw)
Cast 1 to type uint64_t to avoid overflow.
CID 375812 (#1 of 1):
Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
overflow_before_widen: Potentially overflowing expression 1 << 2 * i + 1
with type int (32 bits, signed) is evaluated using 32-bit arithmetic, and
then used in a context that expects an expression of type uint64_t
(64 bits, unsigned).
Coverity issue: 375812
Fixes: 5fec01c35c49 ("net/i40e: support Linux VF to configure IRQ link list")
Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
drivers/net/i40e/i40e_pf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 2435a8a070..39e0c021a4 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -604,7 +604,7 @@ i40e_pf_config_irq_link_list(struct i40e_pf_vf *vf,
tempmap = vvm->txq_map;
for (i = 0; i < sizeof(vvm->txq_map) * BITS_PER_CHAR; i++) {
if (tempmap & 0x1)
- linklistmap |= (1 << (2 * i + 1));
+ linklistmap |= ((uint64_t)1 << (2 * i + 1));
tempmap >>= 1;
}
--
2.27.0
next reply other threads:[~2022-02-23 6:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 6:41 Steve Yang [this message]
2022-02-23 10:28 ` Ferruh Yigit
2022-02-24 1:17 ` [PATCH v2] net/i40e: fix unintentional integer overflow Steve Yang
2022-02-24 3:25 ` Zhang, Qi Z
2022-02-24 4:10 ` Stephen Hemminger
2022-02-24 6:21 ` Yang, SteveX
2022-02-24 11:42 ` Ferruh Yigit
2022-02-25 2:39 ` [PATCH v3] " Steve Yang
2022-02-25 14:48 ` Ferruh Yigit
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=20220223064147.3512888-1-stevex.yang@intel.com \
--to=stevex.yang@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@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 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).