Skip to content

Commit e7e70fa

Browse files
Colin Ian Kingdavem330
authored andcommitted
bnxt_en: don't update cpr->rx_bytes with uninitialized length len
Currently in the cases where cmp_type == CMP_TYPE_RX_L2_TPA_START_CMP or CMP_TYPE_RX_L2_TPA_END_CMP the exit path updates cpr->rx_bytes with an uninitialized length len. Fix this by adding a new exit path that does not update the cpr stats with the bogus length len and remove the unused label next_rx_no_prod. Detected by CoverityScan, CID#1463807 ("Uninitialized scalar variable") Fixes: 6a8788f ("bnxt_en: add support for software dynamic interrupt moderation") Signed-off-by: Colin Ian King <[email protected]> Acked-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 96890d6 commit e7e70fa

File tree

1 file changed

+4
-3
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+4
-3
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons,
15101510
(struct rx_tpa_start_cmp_ext *)rxcmp1);
15111511

15121512
*event |= BNXT_RX_EVENT;
1513-
goto next_rx_no_prod;
1513+
goto next_rx_no_prod_no_len;
15141514

15151515
} else if (cmp_type == CMP_TYPE_RX_L2_TPA_END_CMP) {
15161516
skb = bnxt_tpa_end(bp, bnapi, &tmp_raw_cons,
@@ -1526,7 +1526,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons,
15261526
rc = 1;
15271527
}
15281528
*event |= BNXT_RX_EVENT;
1529-
goto next_rx_no_prod;
1529+
goto next_rx_no_prod_no_len;
15301530
}
15311531

15321532
cons = rxcmp->rx_cmp_opaque;
@@ -1644,9 +1644,10 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons,
16441644
rxr->rx_prod = NEXT_RX(prod);
16451645
rxr->rx_next_cons = NEXT_RX(cons);
16461646

1647-
next_rx_no_prod:
16481647
cpr->rx_packets += 1;
16491648
cpr->rx_bytes += len;
1649+
1650+
next_rx_no_prod_no_len:
16501651
*raw_cons = tmp_raw_cons;
16511652

16521653
return rc;

0 commit comments

Comments
 (0)