Thread (6 messages) 6 messages, 4 authors, 2019-12-04

Re: [PATCH iproute2] tc: fix warning in q_pie.c

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2019-11-27 16:27:07

On Tue, 26 Nov 2019 21:20:59 -0800
Brian Vazquez [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Warning was:
q_pie.c:202:22: error: implicit conversion from 'unsigned long' to
'double'

Fixes: 492ec9558b30 ("tc: pie: change maximum integer value of tc_pie_xstats->prob")
Cc: Leslie Monis <redacted>
Signed-off-by: Brian Vazquez <redacted>
---
 tc/q_pie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tc/q_pie.c b/tc/q_pie.c
index 40982f96..52ba7256 100644
--- a/tc/q_pie.c
+++ b/tc/q_pie.c
@@ -199,7 +199,7 @@ static int pie_print_xstats(struct qdisc_util *qu, FILE *f,
 	st = RTA_DATA(xstats);
 	/*prob is returned as a fracion of maximum integer value */
 	fprintf(f, "prob %f delay %uus avg_dq_rate %u\n",
-		(double)st->prob / UINT64_MAX, st->delay,
+		(double)st->prob / (double)UINT64_MAX, st->delay,
 		st->avg_dq_rate);
 	fprintf(f, "pkts_in %u overlimit %u dropped %u maxq %u ecn_mark %u\n",
 		st->packets_in, st->overlimit, st->dropped, st->maxq,
What compiler is this?
The type seems correct already.  The type of double / unsigned long is double.
And the conversion may give different answer.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help