* [PATCH] Fix warning due to format mismatch for field width argument to fprintf()
@ 2021-05-15 6:49 Heiko Thiery
2021-05-15 7:59 ` Heiko Thiery
0 siblings, 1 reply; 4+ messages in thread
From: Heiko Thiery @ 2021-05-15 6:49 UTC (permalink / raw)
To: netdev; +Cc: Ben Hutchings, Heiko Thiery
bnxt.c:66:54: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘unsigned int’ [-Wformat=]
66 | fprintf(stdout, "Length is too short, expected 0x%lx\n",
| ~~^
| |
| long unsigned int
| %x
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
---
bnxt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bnxt.c b/bnxt.c
index b46db72..0c62d1e 100644
--- a/bnxt.c
+++ b/bnxt.c
@@ -63,7 +63,7 @@ int bnxt_dump_regs(struct ethtool_drvinfo *info __maybe_unused, struct ethtool_r
return 0;
if (regs->len < (BNXT_PXP_REG_LEN + BNXT_PCIE_STATS_LEN)) {
- fprintf(stdout, "Length is too short, expected 0x%lx\n",
+ fprintf(stdout, "Length is too short, expected 0x%x\n",
BNXT_PXP_REG_LEN + BNXT_PCIE_STATS_LEN);
return -1;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix warning due to format mismatch for field width argument to fprintf()
2021-05-15 6:49 [PATCH] Fix warning due to format mismatch for field width argument to fprintf() Heiko Thiery
@ 2021-05-15 7:59 ` Heiko Thiery
2021-05-16 18:11 ` Heiko Thiery
0 siblings, 1 reply; 4+ messages in thread
From: Heiko Thiery @ 2021-05-15 7:59 UTC (permalink / raw)
To: netdev; +Cc: Ben Hutchings, Ben Hutchings
Added Ben's other mail addresses.
Am Sa., 15. Mai 2021 um 08:49 Uhr schrieb Heiko Thiery <heiko.thiery@gmail.com>:
>
> bnxt.c:66:54: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘unsigned int’ [-Wformat=]
> 66 | fprintf(stdout, "Length is too short, expected 0x%lx\n",
> | ~~^
> | |
> | long unsigned int
> | %x
>
> Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
> ---
> bnxt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/bnxt.c b/bnxt.c
> index b46db72..0c62d1e 100644
> --- a/bnxt.c
> +++ b/bnxt.c
> @@ -63,7 +63,7 @@ int bnxt_dump_regs(struct ethtool_drvinfo *info __maybe_unused, struct ethtool_r
> return 0;
>
> if (regs->len < (BNXT_PXP_REG_LEN + BNXT_PCIE_STATS_LEN)) {
> - fprintf(stdout, "Length is too short, expected 0x%lx\n",
> + fprintf(stdout, "Length is too short, expected 0x%x\n",
> BNXT_PXP_REG_LEN + BNXT_PCIE_STATS_LEN);
> return -1;
> }
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix warning due to format mismatch for field width argument to fprintf()
2021-05-15 7:59 ` Heiko Thiery
@ 2021-05-16 18:11 ` Heiko Thiery
2021-05-16 20:40 ` Ben Hutchings
0 siblings, 1 reply; 4+ messages in thread
From: Heiko Thiery @ 2021-05-16 18:11 UTC (permalink / raw)
To: netdev; +Cc: Ben Hutchings, Ben Hutchings
Hi all,
Am Sa., 15. Mai 2021 um 09:59 Uhr schrieb Heiko Thiery <heiko.thiery@gmail.com>:
>
> Added Ben's other mail addresses.
>
> Am Sa., 15. Mai 2021 um 08:49 Uhr schrieb Heiko Thiery <heiko.thiery@gmail.com>:
> >
> > bnxt.c:66:54: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘unsigned int’ [-Wformat=]
> > 66 | fprintf(stdout, "Length is too short, expected 0x%lx\n",
> > | ~~^
> > | |
> > | long unsigned int
> > | %x
> >
> > Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
> > ---
> > bnxt.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/bnxt.c b/bnxt.c
> > index b46db72..0c62d1e 100644
> > --- a/bnxt.c
> > +++ b/bnxt.c
> > @@ -63,7 +63,7 @@ int bnxt_dump_regs(struct ethtool_drvinfo *info __maybe_unused, struct ethtool_r
> > return 0;
> >
> > if (regs->len < (BNXT_PXP_REG_LEN + BNXT_PCIE_STATS_LEN)) {
> > - fprintf(stdout, "Length is too short, expected 0x%lx\n",
> > + fprintf(stdout, "Length is too short, expected 0x%x\n",
> > BNXT_PXP_REG_LEN + BNXT_PCIE_STATS_LEN);
This does not solve the issue. The provided patch only works on 32bit
systems. It seems there is a problem with 32bit vs 64bit.
--
Heiko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix warning due to format mismatch for field width argument to fprintf()
2021-05-16 18:11 ` Heiko Thiery
@ 2021-05-16 20:40 ` Ben Hutchings
0 siblings, 0 replies; 4+ messages in thread
From: Ben Hutchings @ 2021-05-16 20:40 UTC (permalink / raw)
To: Heiko Thiery, netdev
[-- Attachment #1: Type: text/plain, Size: 1967 bytes --]
On Sun, 2021-05-16 at 20:11 +0200, Heiko Thiery wrote:
> Hi all,
>
> Am Sa., 15. Mai 2021 um 09:59 Uhr schrieb Heiko Thiery <heiko.thiery@gmail.com>:
> >
> > Added Ben's other mail addresses.
> >
> > Am Sa., 15. Mai 2021 um 08:49 Uhr schrieb Heiko Thiery <heiko.thiery@gmail.com>:
> > >
> > > bnxt.c:66:54: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘unsigned int’ [-Wformat=]
> > > 66 | fprintf(stdout, "Length is too short, expected 0x%lx\n",
> > > | ~~^
> > > | |
> > > | long unsigned int
> > > | %x
> > >
> > > Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
> > > ---
> > > bnxt.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/bnxt.c b/bnxt.c
> > > index b46db72..0c62d1e 100644
> > > --- a/bnxt.c
> > > +++ b/bnxt.c
> > > @@ -63,7 +63,7 @@ int bnxt_dump_regs(struct ethtool_drvinfo *info __maybe_unused, struct ethtool_r
> > > return 0;
> > >
> > > if (regs->len < (BNXT_PXP_REG_LEN + BNXT_PCIE_STATS_LEN)) {
> > > - fprintf(stdout, "Length is too short, expected 0x%lx\n",
> > > + fprintf(stdout, "Length is too short, expected 0x%x\n",
> > > BNXT_PXP_REG_LEN + BNXT_PCIE_STATS_LEN);
>
> This does not solve the issue. The provided patch only works on 32bit
> systems. It seems there is a problem with 32bit vs 64bit.
It looks like the type of BNXT_PXP_REG_LEN + BNXT_PCIE_STATS_LEN will
be size_t, so the correct format is "%zx".
Ben.
--
Ben Hutchings
Sturgeon's Law: Ninety percent of everything is crap.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-16 20:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-15 6:49 [PATCH] Fix warning due to format mismatch for field width argument to fprintf() Heiko Thiery
2021-05-15 7:59 ` Heiko Thiery
2021-05-16 18:11 ` Heiko Thiery
2021-05-16 20:40 ` Ben Hutchings
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).