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: 10173205 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 40A0B603B5 for ; Thu, 18 Jan 2018 13:17:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FFFB205F7 for ; Thu, 18 Jan 2018 13:17:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24396208C2; Thu, 18 Jan 2018 13:17:19 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1E2EA205F7 for ; Thu, 18 Jan 2018 13:17:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=WBU8A/2p0DnJ3UFAHeTX+1HmErNpsm0v8tiskUVUDlQ=; b=mjp p6co1j+aLeSUUUCyZ2EV+WNJordnCMF7Q/X4TXwTFJtNlwL5pIIar76hV1aGJ/r5T1JRtWG7eqOqQ JxT+CCtOvgv+pjTz2DLV7jEvX3t61MnZ6Cz09Y3qTcIzc9+aPPTxFcuiwywx8pBv3zW42QJ0drJGs 87vk9dCKVGqdqZM1d88Xon8tk0x4Ep450KZB+w4XCAKl9ZwvbjKeZn9lN78PKH41KDGBvclveJtYr FyrJplKrsllC8rv4BGQ2wuSuMf5PVVPmsepKhScN8BLPtPMpT0uudfIQi134donuxgIzlBwEOuBb0 M/nxb/PN18hN8rks343rCnjAtoFAzoA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ecA4B-0002SG-JS; Thu, 18 Jan 2018 13:17:15 +0000 Received: from mout.kundenserver.de ([217.72.192.75]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ecA48-0002Rp-CU for linux-arm-kernel@lists.infradead.org; Thu, 18 Jan 2018 13:17:14 +0000 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" 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== X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Arnd Bergmann , linux-scsi@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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"); } /*