Commit 17169329 authored by Jouni Malinen's avatar Jouni Malinen Committed by Kalle Valo

ath6kl: Fix endpoint_stats debugfs buffer length calculation

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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarJouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 17380859
...@@ -624,8 +624,9 @@ static ssize_t ath6kl_endpoint_stats_read(struct file *file, ...@@ -624,8 +624,9 @@ static ssize_t ath6kl_endpoint_stats_read(struct file *file,
unsigned int buf_len, len = 0; unsigned int buf_len, len = 0;
ssize_t ret_cnt; ssize_t ret_cnt;
buf_len = 1000 + ENDPOINT_MAX * 100; buf_len = sizeof(struct htc_endpoint_stats) / sizeof(u32) *
buf = kzalloc(buf_len, GFP_KERNEL); (25 + ENDPOINT_MAX * 11);
buf = kmalloc(buf_len, GFP_KERNEL);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
...@@ -640,6 +641,7 @@ static ssize_t ath6kl_endpoint_stats_read(struct file *file, ...@@ -640,6 +641,7 @@ static ssize_t ath6kl_endpoint_stats_read(struct file *file,
EPSTAT(tx_dropped); EPSTAT(tx_dropped);
EPSTAT(tx_cred_rpt); EPSTAT(tx_cred_rpt);
EPSTAT(cred_rpt_from_rx); EPSTAT(cred_rpt_from_rx);
EPSTAT(cred_rpt_from_other);
EPSTAT(cred_rpt_ep0); EPSTAT(cred_rpt_ep0);
EPSTAT(cred_from_rx); EPSTAT(cred_from_rx);
EPSTAT(cred_from_other); EPSTAT(cred_from_other);
......
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