Blame SOURCES/0027-scsi-scsi-qla2xxx-avoid-printf-format-warning.patch

3c6e85
From aa2d1f8a0a69a3019f3740d00c1701fd5a4ea030 Mon Sep 17 00:00:00 2001
3c6e85
From: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Date: Thu, 1 Aug 2019 15:54:47 -0400
3c6e85
Subject: [PATCH 027/124] [scsi] scsi: qla2xxx: avoid printf format warning
3c6e85
3c6e85
Message-id: <20190801155618.12650-28-hmadhani@redhat.com>
3c6e85
Patchwork-id: 267800
3c6e85
O-Subject: [RHEL 7.8 e-stor PATCH 027/118] scsi: qla2xxx: avoid printf format warning
3c6e85
Bugzilla: 1729270
3c6e85
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
3c6e85
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
3c6e85
3c6e85
From: Arnd Bergmann <arnd@arndb.de>
3c6e85
3c6e85
Bugzilla 1729270
3c6e85
3c6e85
Depending on the target architecture and configuration, both phys_addr_t
3c6e85
and dma_addr_t may be smaller than 'long long', so we get a warning when
3c6e85
printing either of them using the %llx format string:
3c6e85
3c6e85
drivers/scsi/qla2xxx/qla_iocb.c: In function 'qla24xx_walk_and_build_prot_sglist':
3c6e85
drivers/scsi/qla2xxx/qla_iocb.c:1140:46: error: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type 'dma_addr_t' {aka 'unsigned int'} [-Werror=format=]
3c6e85
         "%s: page boundary crossing (phys=%llx len=%x)\n",
3c6e85
                                           ~~~^
3c6e85
                                           %x
3c6e85
         __func__, sle_phys, sg->length);
3c6e85
                   ~~~~~~~~
3c6e85
drivers/scsi/qla2xxx/qla_iocb.c:1180:29: error: format '%llx' expects argument of type 'long long unsigned int', but argument 7 has type 'dma_addr_t' {aka 'unsigned int'} [-Werror=format=]
3c6e85
        "%s: sg[%x] (phys=%llx sglen=%x) ldma_sg_len: %x dif_bundl_len: %x ldma_needed: %x\n",
3c6e85
                          ~~~^
3c6e85
3c6e85
There are special %pad and %pap format strings in Linux that we could use
3c6e85
here, but since the driver already does 64-bit arithmetic on the values,
3c6e85
using a plain 'u64' seems more consistent here.
3c6e85
3c6e85
Note: A possible related issue may be that the driver possibly checks the
3c6e85
wrong kind of overflow: when an IOMMU is in use, buffers that cross a
3c6e85
32-bit boundary in physical addresses would still be mapped into dma
3c6e85
addresses within the low 4GB space, so I suspect that we actually want to
3c6e85
check sg_dma_address() instead of sg_phys() here.
3c6e85
3c6e85
Fixes: 50b812755e97 ("scsi: qla2xxx: Fix DMA error when the DIF sg buffer crosses 4GB boundary")
3c6e85
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
3c6e85
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
3c6e85
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3c6e85
(cherry picked from commit 038d710fca5bb149d3af2e0b71f1284f8430a979)
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Signed-off-by: Jan Stancek <jstancek@redhat.com>
3c6e85
---
3c6e85
 drivers/scsi/qla2xxx/qla_iocb.c | 4 ++--
3c6e85
 1 file changed, 2 insertions(+), 2 deletions(-)
3c6e85
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
3c6e85
index ba64b3746462..d13772869d4a 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_iocb.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
3c6e85
@@ -1139,7 +1139,7 @@ qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *ha, srb_t *sp,
3c6e85
 	/* if initiator doing write or target doing read */
3c6e85
 	if (direction_to_device) {
3c6e85
 		for_each_sg(sgl, sg, tot_dsds, i) {
3c6e85
-			dma_addr_t sle_phys = sg_phys(sg);
3c6e85
+			u64 sle_phys = sg_phys(sg);
3c6e85
 
3c6e85
 			/* If SGE addr + len flips bits in upper 32-bits */
3c6e85
 			if (MSD(sle_phys + sg->length) ^ MSD(sle_phys)) {
3c6e85
@@ -1185,7 +1185,7 @@ qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *ha, srb_t *sp,
3c6e85
 
3c6e85
 			ql_dbg(ql_dbg_tgt + ql_dbg_verbose, vha, 0xe023,
3c6e85
 			    "%s: sg[%x] (phys=%llx sglen=%x) ldma_sg_len: %x dif_bundl_len: %x ldma_needed: %x\n",
3c6e85
-			    __func__, i, sg_phys(sg), sglen, ldma_sg_len,
3c6e85
+			    __func__, i, (u64)sg_phys(sg), sglen, ldma_sg_len,
3c6e85
 			    difctx->dif_bundl_len, ldma_needed);
3c6e85
 
3c6e85
 			while (sglen) {
3c6e85
-- 
3c6e85
2.13.6
3c6e85