[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PH0PR18MB4474F0C8213F4DC4E399AE47DE3B2@PH0PR18MB4474.namprd18.prod.outlook.com>
Date: Thu, 28 Mar 2024 10:09:37 +0000
From: Hariprasad Kelam <hkelam@...vell.com>
To: Aleksandr Mishin <amishin@...rgos.ru>,
Sunil Kovvuri Goutham
<sgoutham@...vell.com>
CC: Linu Cherian <lcherian@...vell.com>,
Geethasowjanya Akula
<gakula@...vell.com>,
Jerin Jacob <jerinj@...vell.com>,
Subbaraya Sundeep
Bhatta <sbhatta@...vell.com>,
"David S. Miller" <davem@...emloft.net>,
Eric
Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni
<pabeni@...hat.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"lvc-project@...uxtesting.org" <lvc-project@...uxtesting.org>
Subject: [PATCH] octeontx2-af: Add array index check
Hi,
> 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.
>
Since it is a fix, please add "net" to the subject.
Thanks,
Hariprasad k
> Fixes: 91c6945ea1f9 ("octeontx2-af: cn10k: Add RPM MAC support")
> Signed-off-by: Aleksandr Mishin <amishin@...rgos.ru>
> ---
> drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> 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);
> --
> 2.30.2
Powered by blists - more mailing lists