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

Sascha Hauer s.hauer at pengutronix.de
Tue May 28 07:26:47 PDT 2024


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.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list