Re: [PATCH v2 4/7] net: liteeth: do not read past the receive buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



a bit unrelated, also a nitpick:

On Mon May 27, 2024 at 12:27 PM CEST, Sascha Hauer wrote:
> The driver already discards packets bigger than 2048 bytes, but that is
> already larger than the buffer we read the data into. Limit packet size
> to PKTSIZE instead which matches our receive buffer size.
>
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> ---
>  drivers/net/liteeth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/liteeth.c b/drivers/net/liteeth.c
> index 1781e26348..0d63e1da16 100644
> --- a/drivers/net/liteeth.c
> +++ b/drivers/net/liteeth.c
> @@ -223,7 +223,7 @@ static int liteeth_eth_rx(struct eth_device *edev)
>  	}
>  
>  	len = litex_read32(priv->base + LITEETH_WRITER_LENGTH);
> -	if (len == 0 || len > 2048) {
> +	if (len == 0 || len > PKTSIZE) {
>  		len = 0;
>  		dev_err(priv->dev, "%s: invalid len %d\n", __func__, len);
the len here is always zero

>  		litex_write8(priv->base + LITEETH_WRITER_EV_PENDING, reg);






[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux