Skip to content

Commit ef15dde

Browse files
Aleksandr Mishindavem330
authored andcommitted
octeontx2-af: Add array index check
In rvu_map_cgx_lmac_pf() the 'iter', which is used as an array index, can reach value (up to 14) that exceed the size (MAX_LMAC_COUNT = 8) of the array. Fix this bug by adding 'iter' value check. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 91c6945 ("octeontx2-af: cn10k: Add RPM MAC support") Signed-off-by: Aleksandr Mishin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c53fe72 commit ef15dde

File tree

1 file changed

+2
-0
lines changed
  • drivers/net/ethernet/marvell/octeontx2/af

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ static int rvu_map_cgx_lmac_pf(struct rvu *rvu)
160160
continue;
161161
lmac_bmap = cgx_get_lmac_bmap(rvu_cgx_pdata(cgx, rvu));
162162
for_each_set_bit(iter, &lmac_bmap, rvu->hw->lmac_per_cgx) {
163+
if (iter >= MAX_LMAC_COUNT)
164+
continue;
163165
lmac = cgx_get_lmacid(rvu_cgx_pdata(cgx, rvu),
164166
iter);
165167
rvu->pf2cgxlmac_map[pf] = cgxlmac_id_to_bmap(cgx, lmac);

0 commit comments

Comments
 (0)