From patchwork Thu Jan 18 13:16:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10173209 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 76361603B5 for ; Thu, 18 Jan 2018 13:17:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67EB5204BA for ; Thu, 18 Jan 2018 13:17:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C606205FC; Thu, 18 Jan 2018 13:17:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE0AD204BA for ; Thu, 18 Jan 2018 13:17:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756186AbeARNRR (ORCPT ); Thu, 18 Jan 2018 08:17:17 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:51870 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756185AbeARNRQ (ORCPT ); Thu, 18 Jan 2018 08:17:16 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0LaDAk-1f6I9q0r7e-00m5a2; Thu, 18 Jan 2018 14:16:52 +0100 From: Arnd Bergmann To: Russell King , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: fas216: fix sense buffer initialization Date: Thu, 18 Jan 2018 14:16:38 +0100 Message-Id: <20180118131650.893849-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:BfTCuyOWDdSBbfN3Tuys4harYFrEyrMzqArUv+MvB4pVacHLkA9 s61IWxWQXb06S0UY0eav7QYzys8dqlNpEBsbUV+KOW7twqicFglp0aLRDifeBRfuejRtYRW 0F20lbyh5Vw6T4MEJrHOfOOzBJ7q+a6U6PmnsZIlrT7phr0zz6CeweEE4T68CT2lwZWLx+q 34RqY9GopBPsJMGKGc4JA== X-UI-Out-Filterresults: notjunk:1; V01:K0:QAP+3jxeUW0=:xvc4dZhusYipmdW3esyaxY I5ikwKdbSlCYg3Vwp3/Gqf09qeTl9dqKrvtbwOIRs9iQEplgNJpnOKq9M4huSmXkoetYKtMsj WmWC0v2Z3dC1i+yOkOlzBgC4buhEk//Tz5YcTSDJhHWfIXmbTSl0DJTx5iOHGhgbst86MSlzU 4BXgctTiYDsA9Ckc5a/F5St2Asm1brK22xWj7IRmWJVG2sg+1/aaNlxG0IbiVkJsVAGrJZdBO 8qVs0fdvehf2ZSWY0oQxcWcCqmvmksZ0mhNNEOO7MuLd7+1neuMz+TbIHYFywJQWQyEARG95F UPyfDrwrwghlYbudk6xxL5ccugd/vLVuH1cS9mOm/kQdC6xRcsQUPgbhfi70Cys76y5bU4PKD /U8xPywtsplOM2D/DGjgqrsRA713jquun1T/Z3CRCGMdL2s4PFk2VwHpCOs6aUP/zNEY2p1km 2UOYeawAMwqAze2iLFGfQuLF7sOtNYREuoIUf8/AN7I6T/cmW58ulY20eYhFhy1w7TFTDJvMf zzG0Qkc85y31zAA0VHsSS7zL6f0CwZL5guLuWfa8K7V7iFTwB5nCU3Yq5ILgzIUcBaKU7s4bJ iByyQYqIFooVUKL2eAFulGQs4y9G2Vttb72UJYrCg4kWFh9qZs1v1Zcjh50ayQe4lBiz7MihY 0EP0/JI4I8YX2a5jR4RF72f8w5pJKGs1wkcL/ZeG1ZRRIb4wKieU45PEA7dnbhWkgjA5QtfK3 8cGhi8UKGbJIB5iev5UdCpCpXDXsCI+O2H50aA== Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While testing with the ARM specific memset() macro removed, I ran into a compiler warning that shows an old bug: drivers/scsi/arm/fas216.c: In function 'fas216_rq_sns_done': drivers/scsi/arm/fas216.c:2014:40: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess] It turns out that the definition of the scsi_cmd structure changed back in linux-2.6.25, so now we clear only four bytes (sizeof(pointer)) instead of 96 (SCSI_SENSE_BUFFERSIZE). I did not check whether we actually need to initialize the buffer here, but it's clear that if we do it, we should use the correct size. Fixes: de25deb18016 ("[SCSI] use dynamically allocated sense buffer") Signed-off-by: Arnd Bergmann --- drivers/scsi/arm/fas216.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index f4775ca70bab..27bda2b05de6 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c @@ -2011,7 +2011,7 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, * have valid data in the sense buffer that could * confuse the higher levels. */ - memset(SCpnt->sense_buffer, 0, sizeof(SCpnt->sense_buffer)); + memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); //printk("scsi%d.%c: sense buffer: ", info->host->host_no, '0' + SCpnt->device->id); //{ int i; for (i = 0; i < 32; i++) printk("%02x ", SCpnt->sense_buffer[i]); printk("\n"); } /*