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]
Message-ID: <58f8a006-6ede-8bf0-4f89-8ddc0674575e@cogentembedded.com>
Date:   Fri, 12 Oct 2018 11:48:44 +0300
From:   Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:     Ben Dooks <ben.dooks@...ethink.co.uk>, netdev@...r.kernel.org
Cc:     oneukum@...e.com, davem@...emloft.net, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-kernel@...ts.codethink.co.uk
Subject: Re: [PATCH 6/8] usbnet: smsc95xx: fix memcpy for accessing rx-data

Hello!

On 12.10.2018 11:34, Ben Dooks wrote:

> Change the RX code to use get_unaligned_le32() instead of the combo
> of memcpy and cpu_to_le32s(&var).

    le32_to_cpus(), actually.

> Signed-off-by: Ben Dooks <ben.dooks@...ethink.co.uk>
> ---
>  drivers/net/usb/smsc95xx.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
> index 8ce190da8be0..03c3c02b569c 100644
> --- a/drivers/net/usb/smsc95xx.c
> +++ b/drivers/net/usb/smsc95xx.c
> @@ -618,9 +618,7 @@ static void smsc95xx_status(struct usbnet *dev, struct urb *urb)
>  		return;
>  	}
>
> -	memcpy(&intdata, urb->transfer_buffer, 4);
> -	le32_to_cpus(&intdata);
> -
> +	intdata = get_unaligned_le32(urb->transfer_buffer);
>  	netif_dbg(dev, link, dev->net, "intdata: 0x%08X\n", intdata);
>
>  	if (intdata & INT_ENP_PHY_INT_)
> @@ -1922,8 +1920,7 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
>  		unsigned char *packet;
>  		u16 size;
>
> -		memcpy(&header, skb->data, sizeof(header));
> -		le32_to_cpus(&header);
> +		header = get_unaligned_le32(skb->data);
>  		skb_pull(skb, 4 + NET_IP_ALIGN);
>  		packet = skb->data;
>

MBR, Sergei


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ