From patchwork Mon Jul 19 14:51:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 479849 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4204920jao; Mon, 19 Jul 2021 08:00:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzD0AYeQadxEJ6LF2ngJYKwbw4LjfoB+uLMTpnE1M1qMmYkSzANhk12B9cLEyIiwoLIy2CA X-Received: by 2002:a6b:6217:: with SMTP id f23mr19656758iog.173.1626706805492; Mon, 19 Jul 2021 08:00:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626706805; cv=none; d=google.com; s=arc-20160816; b=xhwWqfmB0WFrCdmFylmWno/hquMtZ0gnm31N14MDoMixor23Q/lGSECVHxbAO+pgmS DaWPJmvPjOf7tH1xjkvaQ0L3qIr0tAWT229mbo7g0MbCPp2Ebla9mL721eVaSvQYGCMm dZVmkyOK4/oKiAob+QPGtwLlfgQ+wCKTcldnKdKvV2IzdwOL63RRmQrDfoVOK5GQCNYP Gy/HKUFPEDhnQ38j8UG+ye/0GWIGXNLbgG2LttPMHcPKTJs9jX9KDLGLyGWBja/1KWUK LERdUN5+OkjdzXkUrM5qCtB9lyp5cjzOHvz89HpcnQb7XpyIoROD6dO91tGDfgj4CCr6 Lr1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y/yDbFNP5ZU6uOwh8YVlr80xywQ2fdtZECg2FTyLGmU=; b=0U+bcTrx2G5EiVVdI1ZEt0lF+rkfBpGHkSMQVTOYlL8stu1wwCqIGXuaON+9isOyOi wiizvOYzWxQCHvpEJnOk+g6JNTfr1q+dfpWt0mz6ru9oR6ztnqRvRj1Ug51Ec9jNvASN 2kI0GniQUi1UFGFtvSODA01Z/tYZ58Eb7SpVp6u3DVSmiusmn4g2rtPWpIz20JBhbmDj sdGu+PUag2+YQs8zdbHxhZQxyVG7Vb/CXsV+1OwJxCCRJLmLlgnrbNlLvMjabJ650VVd vMNhs9J4fYPUisQTfRfVpTmVYbXDXhLgkQOMXk49qn5fGPFn/WNzuAZLf2nrapfZEkvQ ytpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=StXtkhvS; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s16si20162461jan.83.2021.07.19.08.00.05; Mon, 19 Jul 2021 08:00:05 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=StXtkhvS; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242245AbhGSOTX (ORCPT + 12 others); Mon, 19 Jul 2021 10:19:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:53426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242131AbhGSOSm (ORCPT ); Mon, 19 Jul 2021 10:18:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D42246112D; Mon, 19 Jul 2021 14:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626706762; bh=lHdeqfKYjwgtzBUNGdz46DWAGCPWre0/g1WWiMcGvN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=StXtkhvSWjqaUPTOUmJPQZOm/B7XMGd4JSmnCkmjx3G5Eh23fkmjIZO2yDGMDPfsI 3z7GDglHoTpBErkQn1KxwGfWJ4tzAYcwdq8vv/07IbDRRFxp2zmFU+aSABi19AmBbN U2onMeu8Kvb5q2JWtXL2QjMpaq047xoGHz0xZwTA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Zhen Lei , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.4 088/188] scsi: mpt3sas: Fix error return value in _scsih_expander_add() Date: Mon, 19 Jul 2021 16:51:12 +0200 Message-Id: <20210719144933.596548323@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144913.076563739@linuxfoundation.org> References: <20210719144913.076563739@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zhen Lei [ Upstream commit d6c2ce435ffe23ef7f395ae76ec747414589db46 ] When an expander does not contain any 'phys', an appropriate error code -1 should be returned, as done elsewhere in this function. However, we currently do not explicitly assign this error code to 'rc'. As a result, 0 was incorrectly returned. Link: https://lore.kernel.org/r/20210514081300.6650-1-thunder.leizhen@huawei.com Fixes: f92363d12359 ("[SCSI] mpt3sas: add new driver supporting 12GB SAS") Reported-by: Hulk Robot Signed-off-by: Zhen Lei Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.30.2 diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 8735e4257028..49b751a8f5f3 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -5014,8 +5014,10 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) handle, parent_handle, (unsigned long long) sas_expander->sas_address, sas_expander->num_phys); - if (!sas_expander->num_phys) + if (!sas_expander->num_phys) { + rc = -1; goto out_fail; + } sas_expander->phy = kcalloc(sas_expander->num_phys, sizeof(struct _sas_phy), GFP_KERNEL); if (!sas_expander->phy) {