Commit af8a9a67 authored by Sergey Ryazanov's avatar Sergey Ryazanov Committed by Kalle Valo

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 <jirislaby@gmail.com>
CC: Nick Kossifidis <mickflemm@gmail.com>
CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent bd6b0242
...@@ -909,7 +909,7 @@ static int open_file_eeprom(struct inode *inode, struct file *file) ...@@ -909,7 +909,7 @@ static int open_file_eeprom(struct inode *inode, struct file *file)
struct ath5k_hw *ah = inode->i_private; struct ath5k_hw *ah = inode->i_private;
bool res; bool res;
int i, ret; int i, ret;
u32 eesize; u32 eesize; /* NB: in 16-bit words */
u16 val, *buf; u16 val, *buf;
/* Get eeprom size */ /* Get eeprom size */
...@@ -932,7 +932,7 @@ static int open_file_eeprom(struct inode *inode, struct file *file) ...@@ -932,7 +932,7 @@ static int open_file_eeprom(struct inode *inode, struct file *file)
/* Create buffer and read in eeprom */ /* Create buffer and read in eeprom */
buf = vmalloc(eesize); buf = vmalloc(eesize * 2);
if (!buf) { if (!buf) {
ret = -ENOMEM; ret = -ENOMEM;
goto err; goto err;
...@@ -952,7 +952,7 @@ static int open_file_eeprom(struct inode *inode, struct file *file) ...@@ -952,7 +952,7 @@ static int open_file_eeprom(struct inode *inode, struct file *file)
} }
ep->buf = buf; ep->buf = buf;
ep->len = i; ep->len = eesize * 2;
file->private_data = (void *)ep; file->private_data = (void *)ep;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment