From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org, Dan Nowlin <dan.nowlin@intel.com>,
Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>,
Xiaolong Ye <xiaolong.ye@intel.com>,
Qi Zhang <qi.z.zhang@intel.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>,
bruce.richardson@intel.com, ian.stokes@intel.com,
stable@dpdk.org
Subject: [PATCH v3 035/129] net/ice/base: fix sign-extension
Date: Tue, 25 Jun 2024 12:12:40 +0100 [thread overview]
Message-ID: <d543d26ecabb6553be2040488d6a95a76485fdd2.1719313663.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1719313663.git.anatoly.burakov@intel.com>
From: Jesse Brandeburg <jesse.brandeburg@intel.com>
Fix a static analysis warning where if the 16-bit value in mask has the high-bit
set, it will be sign extended by the shift left (which converts it to a signed
integer). Avoid this by casting to a u32 to make sure the conversion happens
before the shift and that it stays unsigned.
Fixes: 9467486f179f ("net/ice/base: enable masking for RSS and FD field vectors")
Cc: qi.z.zhang@intel.com
Cc: stable@dpdk.org
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
drivers/net/ice/base/ice_flex_pipe.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c
index e06dbb0885..413b6f8ece 100644
--- a/drivers/net/ice/base/ice_flex_pipe.c
+++ b/drivers/net/ice/base/ice_flex_pipe.c
@@ -1534,16 +1534,14 @@ ice_write_prof_mask_reg(struct ice_hw *hw, enum ice_block blk, u16 mask_idx,
switch (blk) {
case ICE_BLK_RSS:
offset = GLQF_HMASK(mask_idx);
- val = (idx << GLQF_HMASK_MSK_INDEX_S) &
- GLQF_HMASK_MSK_INDEX_M;
- val |= (mask << GLQF_HMASK_MASK_S) & GLQF_HMASK_MASK_M;
+ val = (idx << GLQF_HMASK_MSK_INDEX_S) & GLQF_HMASK_MSK_INDEX_M;
+ val |= ((u32)mask << GLQF_HMASK_MASK_S) & GLQF_HMASK_MASK_M;
break;
case ICE_BLK_FD:
offset = GLQF_FDMASK(mask_idx);
val = (idx << GLQF_FDMASK_MSK_INDEX_S) &
GLQF_FDMASK_MSK_INDEX_M;
- val |= (mask << GLQF_FDMASK_MASK_S) &
- GLQF_FDMASK_MASK_M;
+ val |= ((u32)mask << GLQF_FDMASK_MASK_S) & GLQF_FDMASK_MASK_M;
break;
default:
ice_debug(hw, ICE_DBG_PKG, "No profile masks for block %d\n",
--
2.43.0
next prev parent reply other threads:[~2024-06-25 11:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1718204528.git.anatoly.burakov@intel.com>
[not found] ` <cover.1719313663.git.anatoly.burakov@intel.com>
2024-06-25 11:12 ` [PATCH v3 020/129] net/ice/base: fix memory leak when checking firmware version Anatoly Burakov
2024-06-25 11:12 ` Anatoly Burakov [this message]
2024-06-25 11:14 ` [PATCH v3 115/129] net/ice/base: fix ice_get_ctx() issue Anatoly Burakov
[not found] ` <cover.1719401847.git.anatoly.burakov@intel.com>
2024-06-26 11:41 ` [PATCH v4 015/103] net/ice/base: fix sign-extension Anatoly Burakov
2024-06-26 11:41 ` [PATCH v4 050/103] net/ice/base: fix wrong definition of board type Anatoly Burakov
2024-06-26 11:42 ` [PATCH v4 086/103] net/ice/base: fix masking in ice_get_ctx() Anatoly Burakov
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=d543d26ecabb6553be2040488d6a95a76485fdd2.1719313663.git.anatoly.burakov@intel.com \
--to=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dan.nowlin@intel.com \
--cc=dev@dpdk.org \
--cc=ian.stokes@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=paul.m.stillwell.jr@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=stable@dpdk.org \
--cc=xiaolong.ye@intel.com \
/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).