[PATCH] net: emaclite: Avoid reading negative bytes
Liao Junxuan
mikeljx at 126.com
Tue Jul 19 10:47:35 CEST 2022
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
More information about the U-Boot
mailing list