Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 150688
b: refs/heads/master
c: 581f725
h: refs/heads/master
v: v3
  • Loading branch information
Vasanthakumar Thiagarajan authored and John W. Linville committed Jun 3, 2009
1 parent b086af8 commit 94f7904
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 76963bb602ba91927130a0140d5757a5969e08ac
refs/heads/master: 581f725ccd7e697074aa057fa86bf99b54052c95
22 changes: 14 additions & 8 deletions trunk/drivers/net/wireless/ath/ath9k/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ static ssize_t read_file_debug(struct file *file, char __user *user_buf,
{
struct ath_softc *sc = file->private_data;
char buf[32];
unsigned int len = 0;
len += snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.debug_mask);
unsigned int len;

len = snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.debug_mask);
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}

Expand All @@ -60,12 +61,17 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
struct ath_softc *sc = file->private_data;
unsigned long mask;
char buf[32];
if (copy_from_user(buf, user_buf, (sizeof(buf) - 1) < count ?
(sizeof(buf) - 1) : count))
return 0;
buf[sizeof(buf)-1] = 0;
if (strict_strtoul(buf, 0, &mask) == 0)
sc->debug.debug_mask = mask;
ssize_t len;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EINVAL;

buf[len] = '\0';
if (strict_strtoul(buf, 0, &mask))
return -EINVAL;

sc->debug.debug_mask = mask;
return count;
}

Expand Down

0 comments on commit 94f7904

Please sign in to comment.