Received: by 10.223.185.116 with SMTP id b49csp2333825wrg; Mon, 5 Mar 2018 00:37:06 -0800 (PST) X-Google-Smtp-Source: AG47ELuC143n1K+o8wMk++SYwLvICbAQdCEcsJI3F9LmgZ/x25OIVVkURyOOsERf9yi2BdHQ3owY X-Received: by 2002:a17:902:7045:: with SMTP id h5-v6mr12559354plt.217.1520239025881; Mon, 05 Mar 2018 00:37:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520239025; cv=none; d=google.com; s=arc-20160816; b=HQ7ZrSwJNNhxOeFgSFAjqHg9C6d/UbpcLBxEBdI0WwlbarJLK1XjSOp4K3t8bxtwQG hWtRTKwAicVawvFml+matBq/Yxo789FFZDb9/cfvetBnmvtF2seErt7ItZ1ZWXT2zWCJ igQT0S8RnVmNsQ4xH5xMYS/oyK8y3b09um5xh0qx6Sjnc7no0q8tnb/d95jE2tSKuuLp INUu3CItMRYnomH+leznY1CtMdmPNWKyR7cbOsTeP6CTPVwezxdKgv29dedpPjKBku53 G/mIVU9w4TOfSfUW8UmuoUAlq1RtVNYlaqjYLuiqvEDZ0jkn79euxbsIUy8g73VbLz73 3WFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:arc-authentication-results; bh=qIeCmyPnQDkcE7u2OE5u1FuswtySjQAd/NJaGTEgBhY=; b=swYzxHFJ0qgI4EpiCxXRY7Bwaha20vdREgbJF64tJgp7EuVpEB1LHjOwsbNB9Dfeuw tTHbInXvXYEz+tNjqLOlLefhrIoduRoosnkFNBaOavajTrah6y6sGbEt8mvTwumTrc+K ukgIeclNT0jjst8SP3F+5T/y/LUKkSJDe6kv7zcZ4sPtrKJWoC3wAlaUvGUaFqL2rx3X jE3gTTV38WZpCtVsAdk5VdtGK1gs/pupd47MXsGGWC0zrp5in2fahjcjDAEW2/uAobNW 0NJiKScwhISULn0VgxZ/gJaTivf3cjjl+0pXZMHWvD/XSmJLhjudminnKnU+GSLSEHt5 s5sQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k3si8089862pgn.791.2018.03.05.00.36.51; Mon, 05 Mar 2018 00:37:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933167AbeCEIeu (ORCPT + 99 others); Mon, 5 Mar 2018 03:34:50 -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-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.16.2