From patchwork Mon Mar 5 08:34:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10258359 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 6A36260211 for ; Mon, 5 Mar 2018 08:34:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58C2028972 for ; Mon, 5 Mar 2018 08:34:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B3D528975; Mon, 5 Mar 2018 08:34:52 +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=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 D901A28972 for ; Mon, 5 Mar 2018 08:34:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933180AbeCEIev (ORCPT ); Mon, 5 Mar 2018 03:34:51 -0500 Received: from mout.web.de ([212.227.17.12]:38513 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933031AbeCEIes (ORCPT ); Mon, 5 Mar 2018 03:34:48 -0500 Received: from [192.168.1.2] ([92.228.188.109]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Lp6xk-1eEEDx2Qc8-00exBX; Mon, 05 Mar 2018 09:34:37 +0100 Subject: [PATCH 4/4] scsi: hpsa: Move a variable assignment in hpsa_big_passthru_ioctl() From: SF Markus Elfring To: linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, Don Brace , "James E. J. Bottomley" , "Martin K. Petersen" Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Mon, 5 Mar 2018 09:34:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:+5aL+EfsKkrBKK26qo+BInBS/RRLrH70lzrt9a4lxULfYTLr7kB 9HnJqktaa3OLy/2KM2ViptB6XvknFGyjJzVRndYIQ4P7qRERhyiLe/bOaQCVI7NFsPDiG8v Pq4vHBnAIG5KRF+u89PwThOm9rrM0wvYvMCuPCEP8Dex04ZyYI19UsXFv3m9XovKKfx8Q3q TZmNoSGoD7J525otUHV9w== X-UI-Out-Filterresults: notjunk:1; V01:K0:MkplSZO6ggQ=:PA9RceWX4CUxDNVg0g5Sn1 kdi0k8HfNZOnLM+wVxwXJKmzFebB6dISWIrgIWVqoa8G0cZ29W9PcQb58eXivX+kWHDfe4H5e lisz31XDIJe+isc0PWmXbrbd9YYaWGJm8gRPplhCQua/sBofMZqFazDeWhjRFdAU34eweCkHz J3vUYoSN8Mixr90dZY+vJ7uAzAAEvI2TJrr6bEApsvJJfyZIpjxf0+9VFxfv9r3UDvfsrH6z/ dXcVaxzF6Fv1DSsJP2mZIomLL9icjyJllYZS5u4ELMRfMiSVX+pdgOFtQpzfgdp53QDHqJ/QH imSREbqTfqatnbi2B0le7XaIM200Uq00k8vdQdcW4Kq1Agji9QQnbsDOc/lfvnADeYSQ5ix+M 3zB+9qJVH1beYMA45Cf9BU9Shi0+YM+zaQL8WADjD9rfm4BJ4VbHLvewkLUnZ6AeGhu7LAG+Q yYbuIOrFPrcmzF7OW9ycXhSg+ok8LcOtCLVFwH4QIzLDh/1IMSwcWV0DrYI4XJ2ioKDtNbk4J H34foltMYaSmW9y6iWvFpBcbl2mknyoq/Vj4S31OeA6nZOz7cAY7sW/jmQM8mTaJ7EUDDmWBT SX0zMYjqdAKUg1lpe/xIuvwWGPe1XuXwW9aDJ98sQJ2aVCu8wef0PHRIBJWxHG3WJ9K318fO5 4LEXoxD4ygO4i1m16agDUqmmtYFC6meNLyIQlE8ZMY2MQLYrID1qavoQDze4Fit/4gQDyARvS uoC+419/yTlRTmdVlqXSOaGRLRZjITvrLbXS2oTbHF/aENA/mS5v/ktiM3xZB450Rs4t5efPc rYdP9iFTzaa0wsqbZr8zeswwex+jgk3J9FJfxUUfdnFnzJ3eRU= 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 From: Markus Elfring Date: Sun, 4 Mar 2018 22:16:05 +0100 Move an assignment for the local variable "sg_used" so that its setting will only be performed after corresponding memory allocations succeeded by this function. Signed-off-by: Markus Elfring --- drivers/scsi/hpsa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 86d371ab39e7..bb6df194ac31 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -6380,7 +6380,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) unsigned char **buff; int *buff_size; u64 temp64; - BYTE sg_used = 0; + BYTE sg_used; int status; u32 left; u32 sz; @@ -6420,6 +6420,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) } left = ioc->buf_size; data_ptr = ioc->buf; + sg_used = 0; while (left) { sz = (left > ioc->malloc_size) ? ioc->malloc_size : left; buff_size[sg_used] = sz;