From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753103AbbJFVZN (ORCPT ); Tue, 6 Oct 2015 17:25:13 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:57608 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752760AbbJFVZK (ORCPT ); Tue, 6 Oct 2015 17:25:10 -0400 From: Arnd Bergmann To: James Bottomley , linux-scsi@vger.kernel.org Cc: Hannes Reinecke , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Matthew Wilcox Subject: [PATCH] scsi: advansys: fix big-endian builds Date: Tue, 06 Oct 2015 23:24:28 +0200 Message-ID: <5468884.cIlSBUgeTB@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:PlS+G9K4oAYq3bkS01MpLA5ZZrCQGgSA03v86DFyIJdUy2vP60g tNxBz5/LgndeJYwE6YDmy7Ep+zyDc7XpMRzneBAE4B6Bczkx8sJVBLBt9FmRWrliz6snCnJ gfhLSGpPvamezeD7ARZC17SyFO7yPJS0AH3c9J+6Pf9NjzzFLu7+YflSCmqUw1bfBLAdsoE vn91IVE/XSK4ekXbd16UQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:uO9YPp/ElWg=:UpdgSEcuOaYJpxOykli6dm Ypmedb/y0TRSzBhnOsGon2axMv9MW+ciWK1i6jzgJNd7F/mr6A03e76a8StxAJjZNAw+P6VtZ NzCojx3fRT7xKWvAfqYd+egLNg4v8KtTUwvibY/BAq9p0uXs9fHj1to0RpkMxljDGWnEYZU2/ NJHmhx7giXVmnbHWfd7Pa5bcQ4XOs2jcOgxQZypxbT6zJyfFOUFlt9otgEN8q0OFgUy6LRY8S D56VzXIX6qz4uYpUTGdAj2pfdxijTESLMmmnVLPSNfYZxuQgKD2yL0Fmhb40wk6hl4mNS7aGn cJ1FdwDXvj/TPLuYjFVxFRV9WwFs7OjLtZeKyj/0NFZBaWcsgHwKhzQxjF6rzPD3ZTBgpbtm9 biydu4mZDZHQjjx//gx0Izz3Y2jy+/lY3czh4qG2d5XIqFByeHtcVs5USmEkMdiilchcG5dqa NZyXyEA389YbfA5J2NjVjkuushZfl7ZScap8kyaafwdOAKmgE6B2xWqEUv8L0nQDdY8TCnNQz g7xo6PN06uNtyid/S1t+DA+gTpGsI9PCKn0Ga0Lw8NhfXBk1jU2NxK/wddwgLIFyuDJLIgLBL 9iRMoj9LdaCZdwLeNpTPoDPogWZ648YkWkTK6Mf1PlAJhXi/g+2gPwq7EwtKpXiXpdOBAIk/I M5Z9KmUgjYKwTTxHeqA6OHGq9GPbGXpmcJmp78DtgqW2Q0RrLNnQZDZXWFKd3217p+REPYe1g 8lI5VJfzOej968ng Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Fixes: 811ddc057aac ("advansys: use DMA-API for mapping sense buffer") --- Using willy@linux.intel.com, as the address listed in MAINTAINERS failed: Failed to transport message. Message sending failed since the following recipients were rejected by the server: matthew@wil.cx (The server responded: Requested action not taken: mailbox unavailable invalid DNS MX or A/AAAA resource record) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 4305178e4e01..1c1cd657c380 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -7803,7 +7803,7 @@ adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp, return ASC_BUSY; } scsiqp->sense_addr = cpu_to_le32(sense_addr); - scsiqp->sense_len = cpu_to_le32(SCSI_SENSE_BUFFERSIZE); + scsiqp->sense_len = SCSI_SENSE_BUFFERSIZE; /* Build ADV_SCSI_REQ_Q */