]> git.droids-corp.org - dpdk.git/commitdiff
common/cnxk fix unintended sign extension
authorGowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Sat, 12 Feb 2022 12:38:19 +0000 (18:08 +0530)
committerJerin Jacob <jerinj@marvell.com>
Fri, 18 Feb 2022 04:20:41 +0000 (05:20 +0100)
This patch fixes unintended sign extensions reported in coverity
scan.

Coverity issue: 373258
Fixes: 8ca851cdc598 ("common/cnxk: support dual VLAN insert and strip actions")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
drivers/common/cnxk/roc_npc.c

index df3016f5388bb125031a368e63c7e8711e7d9948..245eb8b74f470ed61d18a25ed68412a6f44d0e6d 100644 (file)
@@ -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;