Skip to contentSkip to conversation

smsc95xx: fix operation on 64-bit systems

PATCH In review Stephen Warren 4 participants 4 messages Mar 23, 2016 – Apr 2, 2016 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smsc95xx: fix operation on 64-bit systems

smsc95xx_read_reg() should calculate sizeof(*data) not sizeof(data) since data is a pointer, and the value pointed at is being transferred over USB, not the value of the pointer. This fixes operation of the driver in 64-bit builds, such as the Raspberry Pi 3.

---
 drivers/usb/eth/smsc95xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/eth/smsc95xx.c +2 -2
index 3099bf4fd4e5..08eaed5c2e03 100644
@@ -188,10 +188,10 @@ static int smsc95xx_read_reg(struct usb_device *udev, u32 index, u32 *data)
 	len = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 			      USB_VENDOR_REQUEST_READ_REGISTER,
 			      USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
-			      0, index, tmpbuf, sizeof(data),
+			      0, index, tmpbuf, sizeof(*data),
 			      USB_CTRL_GET_TIMEOUT);
 	*data = tmpbuf[0];
-	if (len != sizeof(data)) {
+	if (len != sizeof(*data)) {
 		debug("smsc95xx_read_reg failed: index=%d, len=%d",
 		      index, len);
 		return -EIO;
Signature · 1 line
2.7.3
#1 lore raw

PATCH 1/1 smsc95xx: fix operation on 64-bit systems

Quoted 4 lines · Stephen Warren

smsc95xx_read_reg() should calculate sizeof(*data) not sizeof(data) since data is a pointer, and the value pointed at is being transferred over USB, not the value of the pointer. This fixes operation of the driver in 64-bit builds, such as the Raspberry Pi 3.

Thanks!

Quoted 24 lines
---
 drivers/usb/eth/smsc95xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/eth/smsc95xx.c +2 -2
index 3099bf4fd4e5..08eaed5c2e03 100644
@@ -188,10 +188,10 @@ static int smsc95xx_read_reg(struct usb_device *udev, u32 index, u32 *data)
 	len = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 			      USB_VENDOR_REQUEST_READ_REGISTER,
 			      USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
-			      0, index, tmpbuf, sizeof(data),
+			      0, index, tmpbuf, sizeof(*data),
 			      USB_CTRL_GET_TIMEOUT);
 	*data = tmpbuf[0];
-	if (len != sizeof(data)) {
+	if (len != sizeof(*data)) {
 		debug("smsc95xx_read_reg failed: index=%d, len=%d",
 		      index, len);
 		return -EIO;
Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH 1/1 smsc95xx: fix operation on 64-bit systems

In reply to Stephen Warren
Quoted 7 lines · Stephen Warren

smsc95xx_read_reg() should calculate sizeof(*data) not sizeof(data) since data is a pointer, and the value pointed at is being transferred over USB, not the value of the pointer. This fixes operation of the driver in 64-bit builds, such as the Raspberry Pi 3.

#3 lore raw
In reply to Stephen Warren
Quoted 9 lines · Stephen Warren

smsc95xx_read_reg() should calculate sizeof(*data) not sizeof(data) since data is a pointer, and the value pointed at is being transferred over USB, not the value of the pointer. This fixes operation of the driver in 64-bit builds, such as the Raspberry Pi 3.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160401/5d9d0d0b/attachment.sig>