Re: [PATCH] octeontx2-af: Add array index check
From: Jakub Kicinski
Date: Thu Mar 28 2024 - 14:28:31 EST
On Thu, 28 Mar 2024 11:16:48 +0300 Aleksandr Mishin wrote:
> 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.
I'm guessing you got the 14 from:
hw->lmac_per_cgx = (nix_const >> 8) & 0xFULL;
Seems more reasonable to cap the size at that point than every use
afterwards.
--
pw-bot: cr