[PATCH v3 7/9] net: smc911x: do not read past the receive buffer

Jules Maselbas jmaselbas at zdiv.net
Tue May 28 07:37:24 PDT 2024


On Tue May 28, 2024 at 4:26 PM CEST, Sascha Hauer wrote:
> Hi Jules,
>
> On Tue, May 28, 2024 at 03:29:47PM +0200, Jules Maselbas wrote:
> > Hi,
> > 
> > On Tue May 28, 2024 at 10:58 AM CEST, Sascha Hauer wrote:
> > > The hardware may report a packet longer than our receive buffer. Instead
> > > of reading past the read buffer, discard too long packets.
> > >
> > > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> > > ---
> > >  drivers/net/smc911x.c | 16 ++++++++--------
> > >  1 file changed, 8 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
> > > index 1fca58ab84..8a0fa5cc25 100644
> > > --- a/drivers/net/smc911x.c
> > > +++ b/drivers/net/smc911x.c
> > > @@ -460,14 +460,14 @@ static int smc911x_eth_rx(struct eth_device *edev)
> > >  		smc911x_reg_write(priv, RX_CFG, 0);
> > >  
> > >  		tmplen = (pktlen + 3) / 4;
> > > -		while(tmplen--)
> > > -			*data++ = smc911x_reg_read(priv, RX_DATA_FIFO);
> > > -
> > > -		if(status & RX_STS_ES)
> > > -			dev_err(&edev->dev, "dropped bad packet. Status: 0x%08x\n",
> > > -				status);
> > > -		else
> > > -			net_receive(edev, priv->rx_buf, pktlen);
> > I don't see a call to net_receive anymore
>
> D'oh! Thanks for being patient with me. I've sent a fixup. I hope I got
> it correct now.

I don't usually read much patches but i am happy to help :)




More information about the barebox mailing list