netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Baruch Siach <baruch@tkos.co.il>
Cc: Jiri Pirko <jiri@mellanox.com>,
	netdev@vger.kernel.org, Aya Levin <ayal@mellanox.com>,
	Moshe Shemesh <moshe@mellanox.com>
Subject: Re: [PATCH iproute2 1/2] devlink: fix format string warning for 32bit targets
Date: Tue, 25 Jun 2019 11:58:06 -0700	[thread overview]
Message-ID: <20190625115806.01e29659@hermes.lan> (raw)
In-Reply-To: <016aabe2639668b4710b73157ea39e8f97f7d726.1561463345.git.baruch@tkos.co.il>

On Tue, 25 Jun 2019 14:49:04 +0300
Baruch Siach <baruch@tkos.co.il> wrote:

> diff --git a/devlink/devlink.c b/devlink/devlink.c
> index 436935f88bda..b400fab17578 100644
> --- a/devlink/devlink.c
> +++ b/devlink/devlink.c
> @@ -1726,9 +1726,9 @@ static void pr_out_u64(struct dl *dl, const char *name, uint64_t val)
>  		jsonw_u64_field(dl->jw, name, val);
>  	} else {
>  		if (g_indent_newline)
> -			pr_out("%s %lu", name, val);
> +			pr_out("%s %llu", name, val);
>  		else
> -			pr_out(" %s %lu", name, val);
> +			pr_out(" %s %llu", name, val);

But on 64 bit target %llu expects unsigned long long which is 128bit.

The better way to fix this is to use:
#include <inttypes.h>

And the use the macro PRIu64
			pr_out(" %s %"PRIu64, name, val);


  parent reply	other threads:[~2019-06-25 18:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-25 11:49 [PATCH iproute2 1/2] devlink: fix format string warning for 32bit targets Baruch Siach
2019-06-25 11:49 ` [PATCH iproute2 2/2] devlink: fix libc and kernel headers collision Baruch Siach
2019-06-25 18:59   ` Stephen Hemminger
2019-06-25 18:58 ` Stephen Hemminger [this message]
2019-06-26  3:30   ` [PATCH iproute2 1/2] devlink: fix format string warning for 32bit targets Baruch Siach
2019-06-26 14:55     ` 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=20190625115806.01e29659@hermes.lan \
    --to=stephen@networkplumber.org \
    --cc=ayal@mellanox.com \
    --cc=baruch@tkos.co.il \
    --cc=jiri@mellanox.com \
    --cc=moshe@mellanox.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).