diff options
author | Aleksandr Mishin <amishin@t-argos.ru> | 2024-03-28 19:55:05 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-04-03 11:00:33 +0100 |
commit | ef15ddeeb6bee87c044bf7754fac524545bf71e8 (patch) | |
tree | ed0ad004cc58d6300556d4061fe04f215ee0b2ca /drivers/net/ethernet/marvell | |
parent | c53fe72cb5fffd69f2fff104b0119d6e271759c5 (diff) | |
download | linux-ef15ddeeb6bee87c044bf7754fac524545bf71e8.tar.gz linux-ef15ddeeb6bee87c044bf7754fac524545bf71e8.tar.bz2 linux-ef15ddeeb6bee87c044bf7754fac524545bf71e8.zip |
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: 91c6945ea1f9 ("octeontx2-af: cn10k: Add RPM MAC support")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell')
-rw-r--r-- | drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c index 72e060cf6b61..e9bf9231b018 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c @@ -160,6 +160,8 @@ static int rvu_map_cgx_lmac_pf(struct rvu *rvu) continue; lmac_bmap = cgx_get_lmac_bmap(rvu_cgx_pdata(cgx, rvu)); for_each_set_bit(iter, &lmac_bmap, rvu->hw->lmac_per_cgx) { + if (iter >= MAX_LMAC_COUNT) + continue; lmac = cgx_get_lmacid(rvu_cgx_pdata(cgx, rvu), iter); rvu->pf2cgxlmac_map[pf] = cgxlmac_id_to_bmap(cgx, lmac); |