diff mbox

qla2xxx: Fix compile warning

Message ID 20170630235622.4602-1-himanshu.madhani@cavium.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Madhani, Himanshu June 30, 2017, 11:56 p.m. UTC
drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2x00_start_nvme_mq':
include/uapi/linux/byteorder/big_endian.h:32:26: warning: large integer
implicitly truncated to unsigned type [-Woverflow]
 #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))

Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
---
 drivers/scsi/qla2xxx/qla_nvme.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

James Bottomley July 1, 2017, 12:10 a.m. UTC | #1
OK, the subject is technically true, but to most people "fix compile
warning" means yet another pointless patch.  This patch isn't
pointless, though, is it?  The driver is actually broken on big endian
systems without it, so the subject should probably say this because
it's important for distros triaging whether to backport this fix if
they backport the nvme components.

On Fri, 2017-06-30 at 16:56 -0700, Himanshu Madhani wrote:
> drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2x00_start_nvme_mq':
> include/uapi/linux/byteorder/big_endian.h:32:26: warning: large
> integer implicitly truncated to unsigned type [-Woverflow]
>  #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))

This text doesn't explain why you've fixed the bug this way.  It has to
do with the 32 byte reads the card does for the mailbox, so you should
explain what the actual problem the compile warning picked up is and
why you fixed it by doing an entire 32 bit write.

Preferably ASAP because the merge window will open on Monday.

James
diff mbox

Patch

diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 1da8fa8f641d..367cf8613b15 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -441,7 +441,8 @@  static int qla2x00_start_nvme_mq(srb_t *sp)
 				req->ring_ptr++;
 			}
 			cont_pkt = (cont_a64_entry_t *)req->ring_ptr;
-			cont_pkt->entry_type = cpu_to_le32(CONTINUE_A64_TYPE);
+			*((uint32_t *)(&cont_pkt->entry_type)) =
+			    cpu_to_le32(CONTINUE_A64_TYPE);
 
 			cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
 			avail_dsds = 5;