[PATCH] net: emaclite: Avoid reading negative bytes

Michal Simek michal.simek at amd.com
Mon Aug 8 09:58:21 CEST 2022



On 8/6/22 19:41, Ramon Fried wrote:
> CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
> 
> 
> 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.

You need to CC me on these patches to see them.
The patch from Samuel is better and already reviewed it.

Thanks,
Michal


More information about the U-Boot mailing list