Skip to contentSkip to conversation

fix sierra_net endianess bug

PATCH In review Maris Paupe 3 participants 4 messages Mar 14, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix sierra_net endianess bug

Hello,
I have found that sierra_net does not work properly on big-endian systems, it works if bytes are flipped in this particular location.

---

drivers/net/usb/sierra_net.c +1 -1
index b59cf20..cf11924 100644
@@ -779,7 +779,7 @@ static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf)
 	dev_dbg(&dev->udev->dev, "Fw attr: %x\n", fwattr);
 
 	/* test whether firmware supports DHCP */
-	if (!(status == sizeof(fwattr) && (fwattr & SWI_GET_FW_ATTR_MASK))) {
+	if (!(status == sizeof(fwattr) && (le16_to_cpu(fwattr) & SWI_GET_FW_ATTR_MASK))) {
 		/* found incompatible firmware version */
 		dev_err(&dev->udev->dev, "Incompatible driver and firmware"
 			" versions\n");

---

#1 lore raw
Quoted 2 lines · Maris Paupe

I have found that sierra_net does not work properly on big-endian systems, it works if bytes are flipped in this particular location.

That should probably be fixed in sierra_net_get_fw_attr (and the author of sierra_net_get_fw_attr should be hit with a cluestick to not use kmalloc for allocating a single u16).

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#2 lore raw
Quoted 8 lines · Andreas Schwab
Quoted 2 lines · Maris Paupe

I have found that sierra_net does not work properly on big-endian systems, it works if bytes are flipped in this particular location.

That should probably be fixed in sierra_net_get_fw_attr (and the author of sierra_net_get_fw_attr should be hit with a cluestick to not use kmalloc for allocating a single u16).

You cannot use stack buffers for DMA, which includes all USB I/O.

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#3 lore raw
Quoted 11 lines · Ben Hutchings
Quoted 8 lines · Andreas Schwab
Quoted 2 lines · Maris Paupe

I have found that sierra_net does not work properly on big-endian systems, it works if bytes are flipped in this particular location.

That should probably be fixed in sierra_net_get_fw_attr (and the author of sierra_net_get_fw_attr should be hit with a cluestick to not use kmalloc for allocating a single u16).

You cannot use stack buffers for DMA, which includes all USB I/O.

Ok, sorry, I didn't know that.

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."