Skip to contentSkip to conversation

ath5k: fix EEPROM dumping via debugfs

PATCH In review Sergey Ryazanov 2 participants 2 messages Aug 2, 2016 – Sep 3, 2016 Atheros ATH5K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath5k: fix EEPROM dumping via debugfs

EEPROM size calculated in 16-bit words, so we should take into account this fact during buffer allocation.

CC Jiri Slaby <[email protected]>
CC Nick Kossifidis <[email protected]>
CC Luis R. Rodriguez <[email protected]>
---
 drivers/net/wireless/ath/ath5k/debug.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath5k/debug.c +3 -3
index 929d7cc..4f8d9ed 100644
@@ -909,7 +909,7 @@ static int open_file_eeprom(struct inode *inode, struct file *file)
 	struct ath5k_hw *ah = inode->i_private;
 	bool res;
 	int i, ret;
-	u32 eesize;
+	u32 eesize;	/* NB: in 16-bit words */
 	u16 val, *buf;
 
 	/* Get eeprom size */
@@ -932,7 +932,7 @@ static int open_file_eeprom(struct inode *inode, struct file *file)
 
 	/* Create buffer and read in eeprom */
 
-	buf = vmalloc(eesize);
+	buf = vmalloc(eesize * 2);
 	if (!buf) {
 		ret = -ENOMEM;
 		goto err;
@@ -952,7 +952,7 @@ static int open_file_eeprom(struct inode *inode, struct file *file)
 	}
 
 	ep->buf = buf;
-	ep->len = i;
+	ep->len = eesize * 2;
 
 	file->private_data = (void *)ep;
 
Signature · 1 line
2.7.3
#1 lore raw
Quoted 7 lines · Sergey Ryazanov

EEPROM size calculated in 16-bit words, so we should take into account this fact during buffer allocation.

CC Jiri Slaby <[email protected]>
CC Nick Kossifidis <[email protected]>
CC Luis R. Rodriguez <[email protected]>

Thanks, 1 patch applied to wireless-drivers-next.git:

af8a9a67c346 ath5k: fix EEPROM dumping via debugfs

Signature · 2 lines
Sent by pwcli
https://patchwork.kernel.org/patch/9255675/