From patchwork Wed Jan 23 22:42:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10778079 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DBF311515 for ; Wed, 23 Jan 2019 22:42:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEA852D8C7 for ; Wed, 23 Jan 2019 22:42:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCFF72D8E1; Wed, 23 Jan 2019 22:42:40 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 001E92D8C7 for ; Wed, 23 Jan 2019 22:42:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726220AbfAWWmj (ORCPT ); Wed, 23 Jan 2019 17:42:39 -0500 Received: from com-out001.mailprotect.be ([83.217.72.83]:36893 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbfAWWmj (ORCPT ); Wed, 23 Jan 2019 17:42:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:Message-Id :Date:Subject:Cc:To:From:reply-to:sender:bcc:in-reply-to:references: content-type; bh=H72uhK8Xq/FvRa2St/3RXw4lPA/7pVX9KRIssZOV578=; b=nsP5+2v6Hq7Q f+FZz/vB+H9+9sXjctuS3vtS600+wrfQu94C8Bk5T5y2SngPoi+6y0nd96WUXn5g96RDVmJxpTkc0 ifMklficnLR2csuXIeXOdeXgfLARoka2scewS0pt5j5wZ4gupd/YfzqKoSucNklkg1Pw5OEqu07xA 7M1yCo8qwl7GxZKWTu/mzbrUoMlS3jkXkROw1oUFx9JO9yylKfhqwpygPkxPjKwwmXSH77rv0pFTV 7YVwidRxWsL0ousD4slMXTzLKbwBjNfCIls7qW07MWIqQ3ZMO4Lm+Sw4oeof5BwlPqQNrvdH8zXbN 8d3+SKgPBHhtDqHhlwdDyA==; Received: from smtp-auth.mailprotect.be ([178.208.39.159]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gmRE6-0008F9-CV; Wed, 23 Jan 2019 23:42:31 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 475F1C0686; Wed, 23 Jan 2019 23:42:26 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , Christoph Hellwig , Douglas Gilbert , stable@vger.kernel.org Subject: [PATCH] Fix sense handling in __scsi_execute() Date: Wed, 23 Jan 2019 14:42:17 -0800 Message-Id: <20190123224217.198935-1-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.321.g9e740568ce-goog MIME-Version: 1.0 X-Originating-IP: 178.208.39.159 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.04) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxf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8NJdm4PuapgjgeVcU06VRFFYPRcSaFIwna3SYS 9JLHIycXdapFpAEntM8yKElR+Y84QVlpYxz2xudhk69A0F7fA28ugWJagIl51SfPvCwJTlbxntwz s4SUF43BHfI435ChW5DbpQ== X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 Since blk_execute_rq() no longer allocates a sense buffer and no longer initializes the sense pointer the callers of blk_execute_rq() have to do initialize the sense pointer. Hence this patch that initializes rq->sense and that removes a superfluous memcpy() statement. Cc: Christoph Hellwig Cc: Douglas Gilbert Cc: # v4.11+ Fixes: 82ed4db499b8 ("block: split scsi_request out of struct request") Signed-off-by: Bart Van Assche --- drivers/scsi/scsi_lib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 4feba3b5aff1..8b9f4b1bca35 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -271,6 +271,7 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, rq->cmd_len = COMMAND_SIZE(cmd[0]); memcpy(rq->cmd, cmd, rq->cmd_len); rq->retries = retries; + rq->sense = sense; req->timeout = timeout; req->cmd_flags |= flags; req->rq_flags |= rq_flags | RQF_QUIET; @@ -291,8 +292,6 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, if (resid) *resid = rq->resid_len; - if (sense && rq->sense_len) - memcpy(sense, rq->sense, SCSI_SENSE_BUFFERSIZE); if (sshdr) scsi_normalize_sense(rq->sense, rq->sense_len, sshdr); ret = rq->result;