Skip to content

Commit 33b5bc9

Browse files
Tom Rixdavem330
authored andcommitted
octeontx2-af: initialize action variable
Clang static analysis reports this representative issue rvu_npc.c:898:15: warning: Assigned value is garbage or undefined req.match_id = action.match_id; ^ ~~~~~~~~~~~~~~~ The initial setting of action is conditional on if (is_mcam_entry_enabled(...)) The later check of action.op will sometimes be garbage. So initialize action. Reduce setting of *(u64 *)&action = 0x00; to *(u64 *)&action = 0; Fixes: 967db35 ("octeontx2-af: add support for multicast/promisc packet replication feature") Signed-off-by: Tom Rix <trix@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0906f3a commit 33b5bc9

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

  • drivers/net/ethernet/marvell/octeontx2/af

drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ void rvu_npc_install_ucast_entry(struct rvu *rvu, u16 pcifunc,
605605
struct npc_install_flow_req req = { 0 };
606606
struct npc_install_flow_rsp rsp = { 0 };
607607
struct npc_mcam *mcam = &rvu->hw->mcam;
608-
struct nix_rx_action action;
608+
struct nix_rx_action action = { 0 };
609609
int blkaddr, index;
610610

611611
/* AF's and SDP VFs work in promiscuous mode */
@@ -626,7 +626,6 @@ void rvu_npc_install_ucast_entry(struct rvu *rvu, u16 pcifunc,
626626
*(u64 *)&action = npc_get_mcam_action(rvu, mcam,
627627
blkaddr, index);
628628
} else {
629-
*(u64 *)&action = 0x00;
630629
action.op = NIX_RX_ACTIONOP_UCAST;
631630
action.pf_func = pcifunc;
632631
}
@@ -657,7 +656,7 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
657656
struct npc_mcam *mcam = &rvu->hw->mcam;
658657
struct rvu_hwinfo *hw = rvu->hw;
659658
int blkaddr, ucast_idx, index;
660-
struct nix_rx_action action;
659+
struct nix_rx_action action = { 0 };
661660
u64 relaxed_mask;
662661

663662
if (!hw->cap.nix_rx_multicast && is_cgx_vf(rvu, pcifunc))
@@ -685,14 +684,14 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
685684
blkaddr, ucast_idx);
686685

687686
if (action.op != NIX_RX_ACTIONOP_RSS) {
688-
*(u64 *)&action = 0x00;
687+
*(u64 *)&action = 0;
689688
action.op = NIX_RX_ACTIONOP_UCAST;
690689
}
691690

692691
/* RX_ACTION set to MCAST for CGX PF's */
693692
if (hw->cap.nix_rx_multicast && pfvf->use_mce_list &&
694693
is_pf_cgxmapped(rvu, rvu_get_pf(pcifunc))) {
695-
*(u64 *)&action = 0x00;
694+
*(u64 *)&action = 0;
696695
action.op = NIX_RX_ACTIONOP_MCAST;
697696
pfvf = rvu_get_pfvf(rvu, pcifunc & ~RVU_PFVF_FUNC_MASK);
698697
action.index = pfvf->promisc_mce_idx;
@@ -832,7 +831,7 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
832831
struct rvu_hwinfo *hw = rvu->hw;
833832
int blkaddr, ucast_idx, index;
834833
u8 mac_addr[ETH_ALEN] = { 0 };
835-
struct nix_rx_action action;
834+
struct nix_rx_action action = { 0 };
836835
struct rvu_pfvf *pfvf;
837836
u16 vf_func;
838837

@@ -861,14 +860,14 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
861860
blkaddr, ucast_idx);
862861

863862
if (action.op != NIX_RX_ACTIONOP_RSS) {
864-
*(u64 *)&action = 0x00;
863+
*(u64 *)&action = 0;
865864
action.op = NIX_RX_ACTIONOP_UCAST;
866865
action.pf_func = pcifunc;
867866
}
868867

869868
/* RX_ACTION set to MCAST for CGX PF's */
870869
if (hw->cap.nix_rx_multicast && pfvf->use_mce_list) {
871-
*(u64 *)&action = 0x00;
870+
*(u64 *)&action = 0;
872871
action.op = NIX_RX_ACTIONOP_MCAST;
873872
action.index = pfvf->mcast_mce_idx;
874873
}

0 commit comments

Comments
 (0)