[PATCH] net: emaclite: Avoid reading negative bytes

Ramon Fried rfried.dev at gmail.com
Sat Aug 6 19:41:33 CEST 2022


On Tue, Jul 19, 2022 at 6:30 PM Liao Junxuan <mikeljx at 126.com> wrote:
>
> As far as I know, an IP packet isn't necessarily shorter than an ARP
> packet, and if length < first_read, xemaclite_alignedread() goes into
> an infinite loop.
> ---
>  drivers/net/xilinx_emaclite.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
> index 43fc36dc..134973a5 100644
> --- a/drivers/net/xilinx_emaclite.c
> +++ b/drivers/net/xilinx_emaclite.c
> @@ -526,7 +526,7 @@ try_again:
>         }
>
>         /* Read the rest of the packet which is longer then first read */
> -       if (length != first_read)
> +       if (length > first_read)
>                 xemaclite_alignedread(addr + first_read,
>                                       etherrxbuff + first_read,
>                                       length - first_read);
> --
> 2.37.1
>
There's a similar patch here.
https://lists.denx.de/pipermail/u-boot/2022-July/488770.html
I let michal review it.


More information about the U-Boot mailing list