]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: mpi3mr: Use proper format specifier in mpi3mr_sas_port_add()
authorNathan Chancellor <nathan@kernel.org>
Tue, 14 May 2024 20:47:23 +0000 (13:47 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 15 May 2024 13:41:39 +0000 (09:41 -0400)
When building for a 32-bit platform such as ARM or i386, for which size_t
is unsigned int, there is a warning due to using an unsigned long format
specifier:

  drivers/scsi/mpi3mr/mpi3mr_transport.c:1370:11: error: format specifies type 'unsigned long' but the argument has type 'unsigned int' [-Werror,-Wformat]
   1369 |                         ioc_warn(mrioc, "skipping port %u, max allowed value is %lu\n",
        |                                                                                 ~~~
        |                                                                                 %u
   1370 |                             i, sizeof(mr_sas_port->phy_mask) * 8);
        |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use the proper format specifier for size_t, %zu, to resolve the warning for
all platforms.

Fixes: 3668651def2c ("scsi: mpi3mr: Sanitise num_phys")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20240514-mpi3mr-fix-wformat-v1-1-f1ad49217e5e@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpi3mr/mpi3mr_transport.c

index 7ca9a7c2709cfed3b2741de872ab2900a7bb64ee..5d261c2f2d20051087a6c8af6b7e70f18f990d30 100644 (file)
@@ -1366,7 +1366,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;
                }