linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] eeprom_93cx6: do not assume zeroed buffer
@ 2007-04-13 14:17 Michael Wu
  2007-04-13 15:24 ` Ivo van Doorn
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Wu @ 2007-04-13 14:17 UTC (permalink / raw)
  To: John Linville; +Cc: Ivo van Doorn, Andrea Merello, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]

eeprom_93cx6: do not assume zeroed buffer

From: Michael Wu <flamingice@sourmilk.net>

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

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

Signed-off-by: Michael Wu <flamingice@sourmilk.net>
---

 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 #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] eeprom_93cx6: do not assume zeroed buffer
  2007-04-13 14:17 [PATCH] eeprom_93cx6: do not assume zeroed buffer Michael Wu
@ 2007-04-13 15:24 ` Ivo van Doorn
  0 siblings, 0 replies; 2+ messages in thread
From: Ivo van Doorn @ 2007-04-13 15:24 UTC (permalink / raw)
  To: Michael Wu; +Cc: John Linville, Andrea Merello, linux-wireless

On Friday 13 April 2007 16:17, Michael Wu wrote:
> eeprom_93cx6: do not assume zeroed buffer
> 
> From: Michael Wu <flamingice@sourmilk.net>
> 
> eeprom_93cx6_read_bits assumes u16 *data is already zeroed. This removes
> that assumption.

ACK. :)
This was indeed an issue where I was doubting if the driver should make sure the data
was set to zero or that the calling driver should be responsible.

Ivo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-04-13 15:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-13 14:17 [PATCH] eeprom_93cx6: do not assume zeroed buffer Michael Wu
2007-04-13 15:24 ` Ivo van Doorn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).