[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190625115806.01e29659@hermes.lan>
Date: Tue, 25 Jun 2019 11:58:06 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Baruch Siach <baruch@...s.co.il>
Cc: Jiri Pirko <jiri@...lanox.com>, netdev@...r.kernel.org,
Aya Levin <ayal@...lanox.com>,
Moshe Shemesh <moshe@...lanox.com>
Subject: Re: [PATCH iproute2 1/2] devlink: fix format string warning for
32bit targets
On Tue, 25 Jun 2019 14:49:04 +0300
Baruch Siach <baruch@...s.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);
Powered by blists - more mailing lists