Search Linux Wireless

[PATCH] eeprom_93cx6: do not assume zeroed buffer

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

 



eeprom_93cx6: do not assume zeroed buffer

From: Michael Wu <flamingice@xxxxxxxxxxxx>

eeprom_93cx6_read_bits assumes u16 *data is already zeroed. This removes
that assumption.

Thanks to Andrea Merello <andreamrl@xxxxxxxxxx> for discovering this issue.

Signed-off-by: Michael Wu <flamingice@xxxxxxxxxxxx>
---

 drivers/misc/eeprom_93cx6.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/eeprom_93cx6.c b/drivers/misc/eeprom_93cx6.c
index e5d016b..a948ddc 100644
--- a/drivers/misc/eeprom_93cx6.c
+++ b/drivers/misc/eeprom_93cx6.c
@@ -127,6 +127,7 @@ static void eeprom_93cx6_read_bits(struct eeprom_93cx6 
*eeprom,
 	u16 *data, const u16 count)
 {
 	unsigned int i;
+	u16 buf = 0;
 
 	eeprom->register_read(eeprom);
 
@@ -153,10 +154,12 @@ static void eeprom_93cx6_read_bits(struct eeprom_93cx6 
*eeprom,
 		 * Read if the bit has been set.
 		 */
 		if (eeprom->reg_data_out)
-			*data |= (1 << (i - 1));
+			buf |= (1 << (i - 1));
 
 		eeprom_93cx6_pulse_low(eeprom);
 	}
+
+	*data = buf;
 }
 
 static void eeprom_93cx6_ewen(struct eeprom_93cx6 *eeprom)

Attachment: pgptw39YWA9m7.pgp
Description: PGP signature


[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