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:	Wed, 29 Jul 2015 12:14:01 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	Woojung.Huh@...rochip.com
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH net-next 1/1] Microchip's LAN7800 family USB 2/3 to
 10/100/1000 Ethernet device driver

From: <Woojung.Huh@...rochip.com>
Date: Mon, 27 Jul 2015 19:59:30 +0000

> +static int lan78xx_read_stats(struct lan78xx_net *dev,
> +			      struct lan78xx_statstage *data)
> +{
> +	int ret = 0;
> +	struct lan78xx_statstage *stats;
> +
> +	BUG_ON(!dev);
> +	BUG_ON(!data);
> +	BUG_ON(sizeof(struct lan78xx_statstage) != 0xBC);
> +
> +	stats = kmalloc(sizeof(*stats), GFP_KERNEL);
> +	if (!stats)
> +		return -ENOMEM;
> +
> +	ret = usb_control_msg(dev->udev,
> +			      usb_rcvctrlpipe(dev->udev, 0),
> +			      USB_VENDOR_REQUEST_GET_STATS,
> +			      USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> +			      0,
> +			      0,
> +			      (void *)stats,
> +			      sizeof(*stats),
> +			      USB_CTRL_SET_TIMEOUT);
> +	if (likely(ret >= 0)) {
> +		le32_to_cpus(stats);
> +		*data = *stats;

This doesn't work.

le32_to_cpus() will only byte swap the first 'u32' in this statistics structure,
not all of them.

You have to explicitly byte swap each and every member.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ