Skip to contentSkip to conversation

qla2xxx: fix printk format string

PATCH Applied Arnd Bergmann 5 participants 6 messages Jan 17, 2023 – Jan 27, 2023

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

PATCH 1/1 qla2xxx: fix printk format string

From: Arnd Bergmann <[email protected]>

Printing a size_t value that is the result of the sizeof() operator requires using the %z format string modifier to avoid a warning on 32-bit architectures:

drivers/scsi/qla2xxx/qla_mid.c: In function 'qla_create_buf_pool':
drivers/scsi/qla2xxx/qla_mid.c:1094:51: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Werror=format=]

 1094 |                     "Failed to allocate buf_map(%ld).\n", sz * sizeof(unsigned long));
      |                                                 ~~^       ~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                   |          |
      |                                                   long int   unsigned int
      |                                                 %d
Fixes 82d8dfd2a238 ("scsi: qla2xxx: edif: Fix performance dip due to lock contention")
---
 drivers/scsi/qla2xxx/qla_mid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_mid.c +1 -1
index c6ca39b8e23d..1483f6258f92 100644
@@ -1091,7 +1091,7 @@ int qla_create_buf_pool(struct scsi_qla_host *vha, struct qla_qpair *qp)
 	qp->buf_pool.buf_map   = kcalloc(sz, sizeof(long), GFP_KERNEL);
 	if (!qp->buf_pool.buf_map) {
 		ql_log(ql_log_warn, vha, 0x0186,
-		    "Failed to allocate buf_map(%ld).\n", sz * sizeof(unsigned long));
+		    "Failed to allocate buf_map(%zd).\n", sz * sizeof(unsigned long));
 		return -ENOMEM;
 	}
 	sz = qp->req->length * sizeof(void *);
Signature · 1 line
2.39.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Printing a size_t value that is the result of the sizeof() operator requires using the %z format string modifier to avoid a warning on 32-bit architectures:

drivers/scsi/qla2xxx/qla_mid.c: In function 'qla_create_buf_pool':
drivers/scsi/qla2xxx/qla_mid.c:1094:51: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Werror=format=]

  1094 |                     "Failed to allocate buf_map(%ld).\n", sz * sizeof(unsigned long));
       |                                                 ~~^       ~~~~~~~~~~~~~~~~~~~~~~~~~~
       |                                                   |          |
       |                                                   long int   unsigned int
       |                                                 %d
Fixes 82d8dfd2a238 ("scsi: qla2xxx: edif: Fix performance dip due to lock contention")
---
  drivers/scsi/qla2xxx/qla_mid.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_mid.c +0 -0
index c6ca39b8e23d..1483f6258f92 100644

drivers/scsi/qla2xxx/qla_mid.c int qla_create_buf_pool(struct scsi_qla_host *vha, struct qla_qpair *qp) · line 1097

Quoted 8 lines
drivers/scsi/qla2xxx/qla_mid.c +1 -1
@@ -1091,7 +1091,7 @@ int qla_create_buf_pool(struct scsi_qla_host *vha, struct qla_qpair *qp)
  	qp->buf_pool.buf_map   = kcalloc(sz, sizeof(long), GFP_KERNEL);
  	if (!qp->buf_pool.buf_map) {
  		ql_log(ql_log_warn, vha, 0x0186,
-		    "Failed to allocate buf_map(%ld).\n", sz * sizeof(unsigned long));
+		    "Failed to allocate buf_map(%zd).\n", sz * sizeof(unsigned long));
  		return -ENOMEM;
  	}
  	sz = qp->req->length * sizeof(void *);
Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 39 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Printing a size_t value that is the result of the sizeof() operator requires using the %z format string modifier to avoid a warning on 32-bit architectures:

drivers/scsi/qla2xxx/qla_mid.c: In function 'qla_create_buf_pool':
drivers/scsi/qla2xxx/qla_mid.c:1094:51: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Werror=format=]

1094 |                     "Failed to allocate buf_map(%ld).\n", sz * sizeof(unsigned long));
     |                                                 ~~^       ~~~~~~~~~~~~~~~~~~~~~~~~~~
     |                                                   |          |
     |                                                   long int   unsigned int
     |                                                 %d
Fixes 82d8dfd2a238 ("scsi: qla2xxx: edif: Fix performance dip due to lock contention")

---
drivers/scsi/qla2xxx/qla_mid.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_mid.c +1 -1
index c6ca39b8e23d..1483f6258f92 100644
@@ -1091,7 +1091,7 @@ int qla_create_buf_pool(struct scsi_qla_host *vha, struct qla_qpair *qp)
 qp->buf_pool.buf_map   = kcalloc(sz, sizeof(long), GFP_KERNEL);
 if (!qp->buf_pool.buf_map) {
 ql_log(ql_log_warn, vha, 0x0186,
-    "Failed to allocate buf_map(%ld).\n", sz * sizeof(unsigned long));
+    "Failed to allocate buf_map(%zd).\n", sz * sizeof(unsigned long));
 return -ENOMEM;
 }
 sz = qp->req->length * sizeof(void *);
Signature · 1 line
2.39.0
Reviewed-by Himanshu Madhani <[email protected] <mailto:[email protected]>>
Signature · 1 line
Himanshu Madhani Oracle Linux Engineering
Reviewed-by on v1 1/1
#3 lore raw
In reply to Arnd Bergmann
Quoted 7 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Printing a size_t value that is the result of the sizeof() operator requires using the %z format string modifier to avoid a warning on 32-bit architectures:

drivers/scsi/qla2xxx/qla_mid.c: In function 'qla_create_buf_pool':
drivers/scsi/qla2xxx/qla_mid.c:1094:51: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Werror=format=]

Quoted 8 lines
 1094 |                     "Failed to allocate buf_map(%ld).\n", sz * sizeof(unsigned long));
      |                                                 ~~^       ~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                   |          |
      |                                                   long int   unsigned int
      |                                                 %d
Fixes 82d8dfd2a238 ("scsi: qla2xxx: edif: Fix performance dip due to lock contention")

Thanks for the patch!

Quoted 21 lines
---
 drivers/scsi/qla2xxx/qla_mid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_mid.c +1 -1
index c6ca39b8e23d..1483f6258f92 100644
@@ -1091,7 +1091,7 @@ int qla_create_buf_pool(struct scsi_qla_host *vha, struct qla_qpair *qp)
 	qp->buf_pool.buf_map   = kcalloc(sz, sizeof(long), GFP_KERNEL);
 	if (!qp->buf_pool.buf_map) {
 		ql_log(ql_log_warn, vha, 0x0186,
-		    "Failed to allocate buf_map(%ld).\n", sz * sizeof(unsigned long));
+		    "Failed to allocate buf_map(%zd).\n", sz * sizeof(unsigned long));
 		return -ENOMEM;
 	}
 	sz = qp->req->length * sizeof(void *);
Signature · 1 line
2.39.0
#4 lore raw
In reply to Arnd Bergmann

Arnd,

Quoted 3 lines

Printing a size_t value that is the result of the sizeof() operator requires using the %z format string modifier to avoid a warning on 32-bit architectures:

Applied to 6.3/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#5 lore raw
In reply to Arnd Bergmann
Quoted 5 lines · Arnd Bergmann

Printing a size_t value that is the result of the sizeof() operator requires using the %z format string modifier to avoid a warning on 32-bit architectures:

drivers/scsi/qla2xxx/qla_mid.c: In function 'qla_create_buf_pool':
drivers/scsi/qla2xxx/qla_mid.c:1094:51: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Werror=format=]

Quoted 7 lines
 1094 |                     "Failed to allocate buf_map(%ld).\n", sz * sizeof(unsigned long));
      |                                                 ~~^       ~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                   |          |
      |                                                   long int   unsigned int
      |                                                 %d

[...]

Applied to 6.3/scsi-queue, thanks!

[1/1] qla2xxx: fix printk format string

      https://git.kernel.org/mkp/scsi/c/d794a23113b1
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering