All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Siddharth Vadapalli <s-vadapalli@ti.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, c-vankar@ti.com,
	vadim.fedorenko@linux.dev, v-singh1@ti.com, nm@ti.com,
	daniel.zahka@gmail.com, nora.schiffer@ew.tq-group.com,
	oss@vassilevski.com, grygorii.strashko@ti.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, srk@ti.com
Subject: Re: [PATCH net] net: ethernet: ti: am65-cpsw-nuss: Fix port_id extraction from SRC TAG
Date: Tue, 11 Aug 2026 08:48:35 +0100	[thread overview]
Message-ID: <20260811074835.GW51943@horms.kernel.org> (raw)
In-Reply-To: <d7841492-7e2a-4f4e-ae82-8058c7f4c6a5@ti.com>

On Tue, Aug 11, 2026 at 10:38:55AM +0530, Siddharth Vadapalli wrote:
> On 10/08/26 22:26, Simon Horman wrote:
> > This is an AI-generated review of your patch. The human sending this
> > email has considered the AI review valid, or at least plausible.
> > Full review at: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260807111738.2055900-1-s-vadapalli@ti.com?part=1
> > ---
> > --- Patch [1]: [PATCH net] net: ethernet: ti: am65-cpsw-nuss: Fix port_id extraction from SRC TAG ---
> > commit b0ed959d350c90d8b49f6f81eba7461fbc86dcf4
> > Author: Siddharth Vadapalli <s-vadapalli@ti.com>
> > 
> > net: ethernet: ti: am65-cpsw-nuss: Fix port_id extraction from SRC TAG
> > 
> > The RX path extracts the ingress MAC port ID from the CPPI5 descriptor's
> > 16-bit Source Tag. Only the lower 8 bits carry the port ID, so the patch
> > masks the value with 0xFF before it is used as an index into
> > common->ports[].
> > 
> > > diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> > > index 434a31080855..6330540979d7 100644
> > > --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> > > +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> > > @@ -1310,6 +1310,8 @@ static int am65_cpsw_nuss_rx_packets(struct am65_cpsw_rx_flow *flow,
> > >   	k3_udma_glue_rx_cppi5_to_dma_addr(rx_chn->rx_chn, &buf_dma);
> > >   	pkt_len = cppi5_hdesc_get_pktlen(desc_rx);
> > >   	cppi5_desc_get_tags_ids(&desc_rx->hdr, &port_id, NULL);
> > > +	/* Port ID is contained in the lower 8-bits of the 16-bit Source Tag */
> > > +	port_id &= 0xFF;
> > >   	dev_dbg(dev, "%s rx port_id:%d\n", __func__, port_id);
> > >   	port = am65_common_get_port(common, port_id);
> > >   	ndev = port->ndev;
> > 
> > [Severity: High]
> > [Finding: main-1-0]
> > [Sources: opus-5]
> > 
> > The missing range check on port_id is pre-existing and not introduced by
> > this patch, but since the change is specifically about avoiding the
> > out-of-bounds access, would it be worth validating the value instead of
> > relying only on the mask?
> 
> Hardware guarantees a valid Port ID in the lower 8-bits. A Software check is
> an unnecessary overhead and will impact performance since this is on the
> data-path and is not a one-time check during initialization.

...

Hi Siddharth,

Thanks for addressing the AI generated review.
This all looks good to me now.

Reviewed-by: Simon Horman <horms@kernel.org>


      reply	other threads:[~2026-08-11  7:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 11:17 [PATCH net] net: ethernet: ti: am65-cpsw-nuss: Fix port_id extraction from SRC TAG Siddharth Vadapalli
2026-08-09 20:27 ` Chintan Vankar
2026-08-10 16:56 ` Simon Horman
2026-08-11  5:08   ` Siddharth Vadapalli
2026-08-11  7:48     ` Simon Horman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260811074835.GW51943@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=c-vankar@ti.com \
    --cc=daniel.zahka@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=grygorii.strashko@ti.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=nora.schiffer@ew.tq-group.com \
    --cc=oss@vassilevski.com \
    --cc=pabeni@redhat.com \
    --cc=s-vadapalli@ti.com \
    --cc=srk@ti.com \
    --cc=v-singh1@ti.com \
    --cc=vadim.fedorenko@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.