Skip to content

Commit

Permalink
ath6kl: Fix endpoint_stats debugfs buffer length calculation
Browse files Browse the repository at this point in the history
The previous version did not really make much sense and the theoretical
maximum length would be a bit longer. Calculate the length more
accurately. In addition, there is no need to clear the buffer, so use
kmalloc instead of kzalloc. For bonus points, add the forgotten
cred_rpt_from_other value to the file.

Reported-by: Joe Perches <[email protected]>
Signed-off-by: Jouni Malinen <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
  • Loading branch information
jmalinen authored and kvalo committed Nov 11, 2011
1 parent 1738085 commit 1716932
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/wireless/ath/ath6kl/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,9 @@ static ssize_t ath6kl_endpoint_stats_read(struct file *file,
unsigned int buf_len, len = 0;
ssize_t ret_cnt;

buf_len = 1000 + ENDPOINT_MAX * 100;
buf = kzalloc(buf_len, GFP_KERNEL);
buf_len = sizeof(struct htc_endpoint_stats) / sizeof(u32) *
(25 + ENDPOINT_MAX * 11);
buf = kmalloc(buf_len, GFP_KERNEL);
if (!buf)
return -ENOMEM;

Expand All @@ -640,6 +641,7 @@ static ssize_t ath6kl_endpoint_stats_read(struct file *file,
EPSTAT(tx_dropped);
EPSTAT(tx_cred_rpt);
EPSTAT(cred_rpt_from_rx);
EPSTAT(cred_rpt_from_other);
EPSTAT(cred_rpt_ep0);
EPSTAT(cred_from_rx);
EPSTAT(cred_from_other);
Expand Down

0 comments on commit 1716932

Please sign in to comment.