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] [day] [month] [year] [list]
Date:   Sat, 15 Feb 2020 01:56:47 -0800 (PST)
From:   David Miller <davem@...emloft.net>
To:     marex@...x.de
Cc:     netdev@...r.kernel.org, lukas@...ner.de, ynezz@...e.cz,
        yuehaibing@...wei.com
Subject: Re: [PATCH 2/3] net: ks8851-ml: Fix 16-bit data access

From: Marek Vasut <marex@...x.de>
Date: Sat, 15 Feb 2020 10:47:56 +0100

> On 2/15/20 10:24 AM, David Miller wrote:
>> From: Marek Vasut <marex@...x.de>
>> Date: Mon, 10 Feb 2020 19:41:38 +0100
>> 
>>> @@ -197,7 +197,7 @@ static inline void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len)
>>>  {
>>>  	len >>= 1;
>>>  	while (len--)
>>> -		*wptr++ = (u16)ioread16(ks->hw_addr);
>>> +		*wptr++ = swab16(ioread16(ks->hw_addr));
>> 
>> I agree with the other feedback, the endianness looks wrong here.
>> 
>> The ioread16() translates whatever is behind ks->hw_addr into cpu
>> endianness.
>> 
>> This is either always little endian (for example), which means that
>> unconditionally swapping this doesn't seem to make sense.
> 
> So what is the suggestion to fix this properly ?

once you know the endianness coming out of ioread16() you can then
use le16_to_cpu() or be16_to_cpu() as appropriate.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ