Skip to contentSkip to conversation

scsi: mpi3mr: Fix a format specifier

PATCH In review Bart Van Assche 3 participants 4 messages May 29, 2024 – May 30, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: mpi3mr: Fix a format specifier

Fix the following compiler warning when building a 32-bit kernel:

./include/linux/kern_levels.h:5:25: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Werror=format=] drivers/scsi/mpi3mr/mpi3mr_transport.c:1367:25: note: in expansion of macro ‘ioc_warn’

 1367 |                         ioc_warn(mrioc, "skipping port %u, max allowed value is %lu\n",
      |                         ^~~~~~~~
Cc Tomas Henzl <[email protected]>
Cc Sathya Prakash Veerichetty <[email protected]>
Fixes 3668651def2c ("scsi: mpi3mr: Sanitise num_phys")
---
 drivers/scsi/mpi3mr/mpi3mr_transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/mpi3mr/mpi3mr_transport.c +1 -1
index 329cc6ec3b58..82aa4e418c5a 100644
@@ -1364,7 +1364,7 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
 			continue;
 
 		if (i > sizeof(mr_sas_port->phy_mask) * 8) {
-			ioc_warn(mrioc, "skipping port %u, max allowed value is %lu\n",
+			ioc_warn(mrioc, "skipping port %u, max allowed value is %zu\n",
 			    i, sizeof(mr_sas_port->phy_mask) * 8);
 			goto out_fail;
 		}
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Bart Van Assche

Fix the following compiler warning when building a 32-bit kernel:

./include/linux/kern_levels.h:5:25: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Werror=format=] drivers/scsi/mpi3mr/mpi3mr_transport.c:1367:25: note: in expansion of macro ‘ioc_warn’

 1367 |                         ioc_warn(mrioc, "skipping port %u, max allowed value is %lu\n",
      |                         ^~~~~~~~
Cc Tomas Henzl <[email protected]>
Cc Sathya Prakash Veerichetty <[email protected]>
Fixes 3668651def2c ("scsi: mpi3mr: Sanitise num_phys")

Looks OK to me.

Signature · 2 lines
Damien Le Moal
Western Digital Research
#2 lore raw
In reply to Bart Van Assche
Quoted 5 lines · Bart Van Assche

Fix the following compiler warning when building a 32-bit kernel:

./include/linux/kern_levels.h:5:25: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Werror=format=] drivers/scsi/mpi3mr/mpi3mr_transport.c:1367:25: note: in expansion of macro ‘ioc_warn’
1367 | ioc_warn(mrioc, "skipping port %u, max allowed value is %lu\n",

see https://lore.kernel.org/linux-scsi/[email protected]/ from two weeks ago.

Quoted 24 lines
       |                         ^~~~~~~~
Cc Tomas Henzl <[email protected]>
Cc Sathya Prakash Veerichetty <[email protected]>
Fixes 3668651def2c ("scsi: mpi3mr: Sanitise num_phys")
---
  drivers/scsi/mpi3mr/mpi3mr_transport.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/mpi3mr/mpi3mr_transport.c +1 -1
index 329cc6ec3b58..82aa4e418c5a 100644
@@ -1364,7 +1364,7 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
  			continue;
 
  		if (i > sizeof(mr_sas_port->phy_mask) * 8) {
-			ioc_warn(mrioc, "skipping port %u, max allowed value is %lu\n",
+			ioc_warn(mrioc, "skipping port %u, max allowed value is %zu\n",
  			    i, sizeof(mr_sas_port->phy_mask) * 8);
  			goto out_fail;
  		}
#3 lore raw
Quoted 8 lines · John Garry
Quoted 5 lines · Bart Van Assche

Fix the following compiler warning when building a 32-bit kernel:

./include/linux/kern_levels.h:5:25: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Werror=format=] drivers/scsi/mpi3mr/mpi3mr_transport.c:1367:25: note: in expansion of macro ‘ioc_warn’
  1367 |                         ioc_warn(mrioc, "skipping port %u, max allowed value is %lu\n",

see https://lore.kernel.org/linux-scsi/[email protected]/ from two weeks ago.

Interesting to see that this patch has been posted before. I had not yet noticed Nathan's patch - I only checked the master branch and Martin's for-next branch before I posted this patch.

Bart.