[PATCH] net: emaclite: fix possible underflow bug

This commit fixes a corner case when length < first_read. which would cause the last argument of xemaclite_alignedread to be a very large unsigned integer.
Signed-off-by: Tianrui Wei tianrui-wei@outlook.com --- 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 43fc36dc6a..3b8f0f4678 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);

This commit fixes a corner case when length < first_read. which would cause the last argument of xemaclite_alignedread to be a very large unsigned integer, resulting in an underflow
Signed-off-by: Tianrui Wei tianrui-wei@outlook.com --- 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 43fc36dc6a..3b8f0f4678 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);
participants (1)
-
Tianrui Wei