advansys: fix big-endian builds
authorArnd Bergmann <arnd@arndb.de>
Mon, 16 Nov 2015 16:49:23 +0000 (17:49 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 18 Nov 2015 15:16:19 +0000 (10:16 -0500)
commit757b22f9d56fb4e510782b29da752824daddf3c8
tree84ba677c113503b478a1a65d71ae5c75cb871ba1
parent0874f8ec9b0a462cc8787b7bb4b7824a1690da10
advansys: fix big-endian builds

Building the advansys driver in a big-endian configuration such as
ARM allmodconfig shows a warning:

 drivers/scsi/advansys.c: In function 'adv_build_req':
 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)))
 drivers/scsi/advansys.c:7806:22: note: in expansion of macro 'cpu_to_le32'
   scsiqp->sense_len = cpu_to_le32(SCSI_SENSE_BUFFERSIZE);

It turns out that the commit that introduced this used the cpu_to_le32()
incorrectly on an 8-bit field, which results in the sense_len to always
be set to zero, as the SCSI_SENSE_BUFFERSIZE value gets moved to upper
byte of the 32-bit intermediate.

This removes the cpu_to_le32() call to restore the original version.

I found this only by looking at the compiler output and have not done a
full review for possible further endianess bugs in the same driver.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 811ddc057aac ("advansys: use DMA-API for mapping sense buffer")
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: stable@vger.kernel.org # v4.2+
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/advansys.c