Skip to content

Commit

Permalink
ath6kl: use a larger buffer for debug output
Browse files Browse the repository at this point in the history
The return value of snprintf() is the number of bytes which would
have been copied if there was enough space, but we want the number of
bytes actually copied.  The scnprintf() function does this.

Also in theory, a %u can take take 10 digits so we may as well make
the buffer larger as well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
  • Loading branch information
Dan Carpenter authored and Kalle Valo committed Nov 24, 2011
1 parent fdb2858 commit 50553c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/wireless/ath/ath6kl/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1550,10 +1550,10 @@ static ssize_t ath6kl_listen_int_read(struct file *file,
size_t count, loff_t *ppos)
{
struct ath6kl *ar = file->private_data;
char buf[16];
char buf[32];
int len;

len = snprintf(buf, sizeof(buf), "%u %u\n", ar->listen_intvl_t,
len = scnprintf(buf, sizeof(buf), "%u %u\n", ar->listen_intvl_t,
ar->listen_intvl_b);

return simple_read_from_buffer(user_buf, count, ppos, buf, len);
Expand Down

0 comments on commit 50553c2

Please sign in to comment.