netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Brian Vazquez <brianvv@google.com>
Cc: Brian Vazquez <brianvv.kernel@gmail.com>,
	David Ahern <dsahern@gmail.com>,
	Mahesh Bandewar <maheshb@google.com>,
	Maciej Zenczykowski <maze@google.com>,
	netdev@vger.kernel.org, Leslie Monis <lesliemonis@gmail.com>
Subject: Re: [PATCH iproute2] tc: fix warning in q_pie.c
Date: Wed, 27 Nov 2019 08:26:55 -0800	[thread overview]
Message-ID: <20191127082655.2e914675@hermes.lan> (raw)
In-Reply-To: <20191127052059.162120-1-brianvv@google.com>

On Tue, 26 Nov 2019 21:20:59 -0800
Brian Vazquez <brianvv@google.com> wrote:

> 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 <lesliemonis@gmail.com>
> Signed-off-by: Brian Vazquez <brianvv@google.com>
> ---
>  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.

  reply	other threads:[~2019-11-27 16:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27  5:20 [PATCH iproute2] tc: fix warning in q_pie.c Brian Vazquez
2019-11-27 16:26 ` Stephen Hemminger [this message]
2019-11-27 16:44   ` Maciej Żenczykowski
2019-11-27 17:25     ` Brian Vazquez
2019-11-28  5:24       ` Leslie Monis
2019-12-04 19:37 ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191127082655.2e914675@hermes.lan \
    --to=stephen@networkplumber.org \
    --cc=brianvv.kernel@gmail.com \
    --cc=brianvv@google.com \
    --cc=dsahern@gmail.com \
    --cc=lesliemonis@gmail.com \
    --cc=maheshb@google.com \
    --cc=maze@google.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).