Re: [PATCH net-next v4 07/13] octeontx2-af: npc: cn20k: Prepare for new SoC

Ratheesh Kannoth
2026-01-23T15:39:38Z

On 2026-01-22 at 14:06:10, Simon Horman (horms@kernel.org) wrote:
> On Tue, Jan 13, 2026 at 03:46:52PM +0530, Ratheesh Kannoth wrote:
> > @@ -945,12 +945,12 @@ void npc_update_entry(struct rvu *rvu, enum key_fields type,
> > kw2 = shift ? val_lo >> (64 - shift) : 0;
> > kw2 |= (val_hi << shift);
> > kw2 &= field->kw_mask[i + 1];
> > - dummy.kw[i + 1] = kw2;
> > + kw[i + 1] = kw2;
>
> Hi Ratheesh,
>
> It's not a problem introduced by this patch.
> But it seems that this could overrun kw if i is max_kw - 1.
> Likewise elsewhere in this loop.
>
> Flagged by Smatch.
ACK.

>
> > /* update entry mask */
> > kw2 = shift ? mask_lo >> (64 - shift) : 0;
> > kw2 |= (mask_hi << shift);
> > kw2 &= field->kw_mask[i + 1];
> > - dummy.kw_mask[i + 1] = kw2;
> > + kw_mask[i + 1] = kw2;
> > break;
> > }
> > /* place remaining bits of key value in kw[x + 1], kw[x + 2] */
> > @@ -961,34 +961,40 @@ void npc_update_entry(struct rvu *rvu, enum key_fields type,
> > kw2 &= field->kw_mask[i + 1];
> > kw3 = shift ? val_hi >> (64 - shift) : 0;
> > kw3 &= field->kw_mask[i + 2];
> > - dummy.kw[i + 1] = kw2;
> > - dummy.kw[i + 2] = kw3;
> > + kw[i + 1] = kw2;
> > + kw[i + 2] = kw3;
> > /* update entry mask */
> > kw2 = shift ? mask_lo >> (64 - shift) : 0;
> > kw2 |= (mask_hi << shift);
> > kw2 &= field->kw_mask[i + 1];
> > kw3 = shift ? mask_hi >> (64 - shift) : 0;
> > kw3 &= field->kw_mask[i + 2];
> > - dummy.kw_mask[i + 1] = kw2;
> > - dummy.kw_mask[i + 2] = kw3;
> > + kw_mask[i + 1] = kw2;
> > + kw_mask[i + 2] = kw3;
> > break;
> > }
> > }
>
> ...