Endianess bug fix for sierra_net

Submitted by Lennart Sorensen on Sept. 7, 2012, 10:14 p.m.

Details

Message ID 20120907221402.GJ15650@csclub.uwaterloo.ca
State Accepted
Delegated to: David Miller
Headers show

Commit Message

Lennart Sorensen Sept. 7, 2012, 10:14 p.m.
I discovered I couldn't get sierra_net to work on a powerpc.  Turns out
the firmware attribute check assumes the system is little endian and
hence fails because the attributes is a 16 bit value.

Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Sept. 10, 2012, 7:06 p.m.
From: "Lennart Sorensen" <lsorense@csclub.uwaterloo.ca>
Date: Fri, 7 Sep 2012 18:14:02 -0400

> I discovered I couldn't get sierra_net to work on a powerpc.  Turns out
> the firmware attribute check assumes the system is little endian and
> hence fails because the attributes is a 16 bit value.
> 
> Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch hide | download patch | download mbox

diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c
index 7be49ea..8e22417 100644
--- a/drivers/net/usb/sierra_net.c
+++ b/drivers/net/usb/sierra_net.c
@@ -656,7 +656,7 @@  static int sierra_net_get_fw_attr(struct usbnet *dev, u16 *datap)
 		return -EIO;
 	}
 
-	*datap = *attrdata;
+	*datap = le16_to_cpu(*attrdata);
 
 	kfree(attrdata);
 	return result;