Re: [PATCH] net: wireless: ath: use div64_u64() instead of do_div()
From: Kalle Valo <kvalo@kernel.org>
Date: 2022-02-10 12:16:41
Qing Wang [off-list ref] writes:
quoted hunk
From: Wang Qing <redacted> do_div() does a 64-by-32 division. When the divisor is u64, do_div() truncates it to 32 bits, this means it can test non-zero and be truncated to zero for division. fix do_div.cocci warning: do_div() does a 64-by-32 division, please consider using div64_u64 instead. Signed-off-by: Wang Qing <redacted> --- drivers/net/wireless/ath/wil6210/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index 4c944e5..2cee9dd --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c@@ -1766,7 +1766,7 @@ __acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock) seq_puts(s, "\n"); if (!num_packets) continue; - do_div(tx_latency_avg, num_packets); + div64_u64(tx_latency_avg, num_packets);
As you have been pointed out in your other patches, do_div() and div64_u64() work differently. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches