Search Linux Wireless

p54: fix EEPROM structure endianness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since the EEPROM structure is read from hardware, it is
always little endian, annotate that in the struct and
make sure to convert where applicable.

Signed-off-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
Cc: Michael Wu <flamingice@xxxxxxxxxxxx>
---
Does anybody have a p54 card and big endian hardware to test it on? I'm
fairly sure this is a correct change but if it currently works on big
endian the change would be bad (and I'd be rather surprised.)

 drivers/net/wireless/p54common.c |    2 +-
 drivers/net/wireless/p54common.h |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

--- everything.orig/drivers/net/wireless/p54common.c	2008-02-28 17:26:23.000000000 +0100
+++ everything/drivers/net/wireless/p54common.c	2008-02-29 13:53:05.000000000 +0100
@@ -212,7 +212,7 @@ int p54_parse_eeprom(struct ieee80211_hw
 	int err;
 
 	wrap = (struct eeprom_pda_wrap *) eeprom;
-	entry = (void *)wrap->data + wrap->len;
+	entry = (void *)wrap->data + le16_to_cpu(wrap->len);
 	i += 2;
 	i += le16_to_cpu(entry->len)*2;
 	while (i < len) {
--- everything.orig/drivers/net/wireless/p54common.h	2008-02-19 23:10:32.000000000 +0100
+++ everything/drivers/net/wireless/p54common.h	2008-02-29 13:53:05.000000000 +0100
@@ -53,10 +53,10 @@ struct pda_entry {
 } __attribute__ ((packed));
 
 struct eeprom_pda_wrap {
-	u32 magic;
-	u16 pad;
-	u16 len;
-	u32 arm_opcode;
+	__le32 magic;
+	__le16 pad;
+	__le16 len;
+	__le32 arm_opcode;
 	u8 data[0];
 } __attribute__ ((packed));
 


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

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux