From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: <dev@dpdk.org>
Cc: Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>, <jerinj@marvell.com>,
Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Subject: [PATCH 2/3] common/cnx: fix unintended sign extension
Date: Sat, 12 Feb 2022 18:08:19 +0530 [thread overview]
Message-ID: <20220212123820.3394341-2-gmuthukrishn@marvell.com> (raw)
In-Reply-To: <20220212123820.3394341-1-gmuthukrishn@marvell.com>
This patch fixes unintended sign extensions reported in coverity
scan.
Fixes: 8ca851cdc59 ("common/cnxk: support dual VLAN insert and strip actions")
Coverity issue: 373258
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
drivers/common/cnxk/roc_npc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index e3961bfbc6..453fd5d3e0 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -969,14 +969,14 @@ npc_vtag_insert_action_configure(struct mbox *mbox, struct roc_npc_flow *flow,
vtag_cfg->cfg_type = VTAG_TX;
vtag_cfg->vtag_size = NIX_VTAGSIZE_T4;
vtag_cfg->tx.vtag0 =
- ((vlan_info[0].vlan_ethtype << 16) |
+ (((uint32_t)vlan_info[0].vlan_ethtype << 16) |
(vlan_info[0].vlan_pcp << 13) | vlan_info[0].vlan_id);
vtag_cfg->tx.cfg_vtag0 = 1;
if (flow->vtag_insert_count == 2) {
vtag_cfg->tx.vtag1 =
- ((vlan_info[1].vlan_ethtype << 16) |
+ (((uint32_t)vlan_info[1].vlan_ethtype << 16) |
(vlan_info[1].vlan_pcp << 13) | vlan_info[1].vlan_id);
vtag_cfg->tx.cfg_vtag1 = 1;
--
2.25.1
next prev parent reply other threads:[~2022-02-12 12:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-12 12:38 [PATCH 1/3] common/cnxk: check return value for error Gowrishankar Muthukrishnan
2022-02-12 12:38 ` Gowrishankar Muthukrishnan [this message]
2022-02-12 12:38 ` [PATCH 3/3] common/cnxk: fix uninitialized pointer read Gowrishankar Muthukrishnan
2022-02-18 4:20 ` [PATCH 1/3] common/cnxk: check return value for error Jerin Jacob
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=20220212123820.3394341-2-gmuthukrishn@marvell.com \
--to=gmuthukrishn@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.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).