Fix warning due to format mismatch for field width argument to fprintf()
Subsystems (2)
PATCH 1/1 Fix warning due to format mismatch for field width argument to fprintf()
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--- bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bnxt.c +1 -1
@@ -63,7 +63,7 @@ int bnxt_dump_regs(struct ethtool_drvinfo *info __maybe_unused, struct ethtool_rreturn 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 ; }
Signature · 1 line
2.20.1
Added Ben's other mail addresses.
Am Sa., 15. Mai 2021 um 08:49 Uhr schrieb Heiko Thiery <[email protected]>:
Quoted 29 lines
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 | %xSigned-off-by Heiko Thiery <[email protected]>--- bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)bnxt.c +1
-2@@ -63,7 +63,7 @@ int bnxt_dump_regs(struct ethtool_drvinfo *info __maybe_unused, struct ethtool_rreturn 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
Hi all,
Am Sa., 15. Mai 2021 um 09:59 Uhr schrieb Heiko Thiery <[email protected]>:
Quoted 24 lines
Added Ben's other mail addresses.
Am Sa., 15. Mai 2021 um 08:49 Uhr schrieb Heiko Thiery <[email protected]>:
Quoted 20 lines
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 | %xSigned-off-by Heiko Thiery <[email protected]>--- bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)bnxt.c +0
-0@@ -63,7 +63,7 @@ int bnxt_dump_regs(struct ethtool_drvinfo *info __maybe_unused, struct ethtool_rreturn 0 ;
Quoted 4 lines
bnxt.c int bnxt_dump_regs(struct ethtool_drvinfo *info __maybe_unused, struct ethtool_r · line 67
Quoted 4 lines
bnxt.c +1
-1if (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.
Signature · 1 line
Heiko
Quoted 27 lines · Heiko Thiery
Hi all,
Am Sa., 15. Mai 2021 um 09:59 Uhr schrieb Heiko Thiery <[email protected]>:
Quoted 24 lines
Added Ben's other mail addresses.
Am Sa., 15. Mai 2021 um 08:49 Uhr schrieb Heiko Thiery <[email protected]>:
Quoted 20 lines
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 | %xSigned-off-by Heiko Thiery <[email protected]>---
bnxt.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)bnxt.c +0
-0@@ -63,7 +63,7 @@ int bnxt_dump_regs(struct ethtool_drvinfo *info __maybe_unused, struct ethtool_r return 0;
Quoted 7 lines
Quoted 4 lines
bnxt.c int bnxt_dump_regs(struct ethtool_drvinfo *info __maybe_unused, struct ethtool_r · line 67
Quoted 4 lines
bnxt.c +1
-1if (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.
Signature · 2 lines
Ben Hutchings Sturgeon's Law: Ninety percent of everything is crap.