Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1111179imm; Wed, 1 Aug 2018 10:21:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpebNrJQ8nLASBLWJy8mCBIu0xC+Hswo6v63ew7LjX+fQ2NNfBDAG3+E4rb0P7BtXG5SimQ6 X-Received: by 2002:a17:902:7247:: with SMTP id c7-v6mr25751116pll.79.1533144096936; Wed, 01 Aug 2018 10:21:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144096; cv=none; d=google.com; s=arc-20160816; b=L4OFef+KaAZPMuyyEuBEcydod4oHYKEAQEi35YWRvAy4QWah6/CyAgGrU8obY+KAje 6jL4skgvqlV84rdaOZUwY1gKd9124If0UymawFkkcz9DEaWGLzGbT2FNqM7Fj3z6FLtc dgN48Szs4euUD9dEVgYrKyAe9gxyLO4q2QCpBUuEiI/+5+PiquzXI2x8D/bz+hVJYouc f83heIpabeWBP9ySaqeOlSBlWYt0kT55e5MTfU0gifAojzOmODqZwtdVFbwN3FNsNE8v JaqUuA0M1pnM4U4ZwSMxcmpGv4y0vLIaBUVyGpPscIo2qOw3+sm55+L0leSHF1eV9FTw 23WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=OvX6RUShUG00BuRsxCdxkM3KwNU29ZrUpu8pwK9Sq3w=; b=cEEAlU1KqzYcz2HoDj34D4CKR7QpomZ/sfuxMjiYGdtA3h3kvGoVPm2ndgP0ZZfVHz u6XMOF7kMI7HvshPUhP41GqQr9BFd0WhWtZWO1IAZyzzbUGC5rbwN9EFSw6SHWRWDsff /RsQQ+rTNpvt8iWUO7jTjBlI3/WrnZmvnplxjnI32p4JLGl5tBmZ5Uk1i6eh6q9zv+GJ BwDT00d50GxkN2Lx/rZqIDZfZwG8GGRU4utdKaLBnSpCCcWp4Gb8zMD/sSMLGezqifNS t5ZtZMj3nTZbe1Zlfr34cxCkooPkmd9kDfOqV+nxkrgLuFG9U8tIFlpYycykdt2P6Pur 65pA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e14-v6si16527488pgj.413.2018.08.01.10.21.22; Wed, 01 Aug 2018 10:21:36 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405276AbeHATGa (ORCPT + 99 others); Wed, 1 Aug 2018 15:06:30 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48644 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403884AbeHATGa (ORCPT ); Wed, 1 Aug 2018 15:06:30 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 25E40CC3; Wed, 1 Aug 2018 17:19:48 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 162/246] scsi: megaraid: silence a static checker bug Date: Wed, 1 Aug 2018 18:51:12 +0200 Message-Id: <20180801165019.495172941@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit 27e833dabab74ee665e487e291c9afc6d71effba ] If we had more than 32 megaraid cards then it would cause memory corruption. That's not likely, of course, but it's handy to enforce it and make the static checker happy. Signed-off-by: Dan Carpenter Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/megaraid.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -4199,6 +4199,9 @@ megaraid_probe_one(struct pci_dev *pdev, int irq, i, j; int error = -ENODEV; + if (hba_count >= MAX_CONTROLLERS) + goto out; + if (pci_enable_device(pdev)) goto out; pci_set_master(pdev);