aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-07-22 04:50:28 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-07-26 15:32:41 -0400
commit9746010bd3c825d364b783b327990d25962657dd (patch)
treeda80f719e9ada0606c0958bea5e32d6132ecb12f /drivers/net/wireless
parent929ebd30e4f982a1d2817f70154e7441f5714118 (diff)
ath9k: snprintf() returns largish values
The snprintf() function returns the number of characters that would have been written (not counting the NUL character on the end). It could potentially be larger than the size of the buffer. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 32438771ca2b..cf9bcc67ade2 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -524,6 +524,9 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
524 len += snprintf(buf + len, sizeof(buf) - len, 524 len += snprintf(buf + len, sizeof(buf) - len,
525 "%19s : %10u\n", "TX Rate", priv->debug.txrate); 525 "%19s : %10u\n", "TX Rate", priv->debug.txrate);
526 526
527 if (len > sizeof(buf))
528 len = sizeof(buf);
529
527 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 530 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
528} 531}
529 532
@@ -569,6 +572,9 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
569 "%20s : %10u\n", "VO queued", 572 "%20s : %10u\n", "VO queued",
570 priv->debug.tx_stats.queue_stats[WME_AC_VO]); 573 priv->debug.tx_stats.queue_stats[WME_AC_VO]);
571 574
575 if (len > sizeof(buf))
576 len = sizeof(buf);
577
572 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 578 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
573} 579}
574 580
@@ -595,6 +601,9 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf,
595 "%20s : %10u\n", "SKBs Dropped", 601 "%20s : %10u\n", "SKBs Dropped",
596 priv->debug.rx_stats.skb_dropped); 602 priv->debug.rx_stats.skb_dropped);
597 603
604 if (len > sizeof(buf))
605 len = sizeof(buf);
606
598 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 607 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
599} 608}
600 609