lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 1 Apr 2022 12:25:52 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Larry Finger <Larry.Finger@...inger.net>
Cc:     Phillip Potter <phil@...lpotter.co.uk>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: r8188eu: Fix PPPoE tag insertion on big endian
 systems

On 4/1/22 11:40, Larry Finger wrote:
> On 4/1/22 10:12, Guenter Roeck wrote:
>> In __nat25_add_pppoe_tag(), the tag length is read from the tag data
>> structure. The value is kept in network format, but read as raw value.
>> With -Warray-bounds, this results in the following gcc error/warning
>> when building the driver on a big endian system such as alpha.
>>
>> In function '__nat25_add_pppoe_tag',
>>      inlined from 'nat25_db_handle' at
>>     drivers/staging/r8188eu/core/rtw_br_ext.c:479:11:
>> arch/alpha/include/asm/string.h:22:16: error:
>>     '__builtin_memcpy' forming offset [40, 2051] is out of the bounds
>>     [0, 40] of object 'tag_buf' with type 'unsigned char[40]'
>>
>> Add the missing ntohs().
>>
>> Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")
>> Cc: Phillip Potter <phil@...lpotter.co.uk>
>> Signed-off-by: Guenter Roeck <linux@...ck-us.net>
>> ---
>>   drivers/staging/r8188eu/core/rtw_br_ext.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
>> index d68611ef22f8..31bcd495ec04 100644
>> --- a/drivers/staging/r8188eu/core/rtw_br_ext.c
>> +++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
>> @@ -70,7 +70,7 @@ static int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_tag *tag)
>>       struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN);
>>       int data_len;
>> -    data_len = tag->tag_len + TAG_HDR_LEN;
>> +    data_len = htons(tag->tag_len) + TAG_HDR_LEN;

Wonder where my brain was. That should have been ntohs().

>>       if (skb_tailroom(skb) < data_len)
>>           return -1;
> 
> Strange that a BE compiler would generate a warning for what is actually an execution error on LE platforms.
> 
> I prefer be16_to_cpu() to htons() as the former makes it clearer what is happening, but I suppose that is a matter of choice.
> 
The rest of the code uses htons/ntohs, so I prefer to follow that lead.

> Reviewed_by: Larry Finger <Larry.Finger@...inger.net>
> 
> Incidentally, Sparse shows 3 more __be16 problems in this routine. I leave their fixing to you.
> 

I'll need to resend anyway, so I'll track those down and fix them as well.

Thanks,
Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ