Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp485342ybl; Tue, 28 Jan 2020 06:41:49 -0800 (PST) X-Google-Smtp-Source: APXvYqypJCI7kDOo6HP20+AINvahocGaK1+dhz9AMoZRjMQTIWmL7zNVFr2IY3ikmoRVsTZS723t X-Received: by 2002:a9d:de9:: with SMTP id 96mr17086478ots.222.1580222509093; Tue, 28 Jan 2020 06:41:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580222509; cv=none; d=google.com; s=arc-20160816; b=CHh6niGP//UggF//oKHVG3sJydw0hcpym1F61DiIRuB3lAgoHpFaw9hAAj50UZ0FAY Y6Cp1DNGlDL8h6KI4VifhmC5R9iom7wfFZ2Cae6t1LCt4SLMnzusSRRRxEm2v19ZDHQ7 7oDNWO+pYunIXTGh5xE9aWz3DP527Hu8T7Ivp56vFUnUvzDaeeJ/zlyzP3wAkX2PCNBv VUhOPldeLamrYe6f2NlJZTsYZp1VsqmTYAiRj0R+81uZFJH7mKB48ZoljPNUHbYVfgg1 PBj+ytr0mQZw28x/LgWkdiMB2AW8mVi7nRGYpE4oQeX3JEr0wPYOa1kCYPJiuJlMiDVZ FLYQ== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dcyf9zWhMPxL1zzubln/YM9TbCk8LQodJKU7RPSUV2w=; b=0xHChGNUHQ7v2kYc4UxF0nDMFCEjJi/Upm8Gqxo8yLhkysnfZ0MYddr0Qw6J28Ytmr DA8fUxGKPRNs9i5JPMByCXbp7RRKDARluQjjVkrYuB5BjE89WW0q5PsntfnrgHelJsy/ TEVaeKLSj65LYhE4B0nG4TMcJGOKPjs7G8liyBEAbxyJjb2ovQ+8dVIMNKnGtPTrSDm2 eZTZ8BF8C+qOnRmcxjXU+IevK4hdy107SlqO6Ixk+c75K4h8quxe+F0yxj8ooDlsbwcU 55Ml6LAOzns+xNr2AYPfzF1PeT2zaGOIjZTW8kAqvOn7jQIYi9XVUHhoNh0Q/tahetlJ ZvoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zMX3cYfr; 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 t185si5072498oib.39.2020.01.28.06.41.37; Tue, 28 Jan 2020 06:41:49 -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; dkim=pass header.i=@kernel.org header.s=default header.b=zMX3cYfr; 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 S1731410AbgA1OjH (ORCPT + 99 others); Tue, 28 Jan 2020 09:39:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:41728 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730576AbgA1ORw (ORCPT ); Tue, 28 Jan 2020 09:17:52 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A81F02071E; Tue, 28 Jan 2020 14:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221072; bh=os7H21hXs8WMcYHpup+mf+HpJ4YSlaMOYYiP6Ir8qHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zMX3cYfrHEY/lWBNsGJ+NMTDNEbmXybG2z+ZjuWzF0Fz9OONjcISI1YgwGaGiQSt5 TJmBWrNd3DtNIf6tiwEssOpf+NFh0x+KBERJLoIkqT43TTnlwzU1lLG4XVYBBYrTnh wbtl4Zou6b3NjcudzAkBuBE2mshbfqYSXsQ1SsQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Axel Lin , Mark Brown , Sasha Levin Subject: [PATCH 4.9 078/271] regulator: pv88060: Fix array out-of-bounds access Date: Tue, 28 Jan 2020 15:03:47 +0100 Message-Id: <20200128135858.363147358@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Axel Lin [ Upstream commit 7cd415f875591bc66c5ecb49bf84ef97e80d7b0e ] Fix off-by-one while iterating current_limits array. The valid index should be 0 ~ n_current_limits -1. Fixes: f307a7e9b7af ("regulator: pv88060: new regulator driver") Signed-off-by: Axel Lin Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/pv88060-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/pv88060-regulator.c b/drivers/regulator/pv88060-regulator.c index 6c4afc73ecac3..d229245d2b5e8 100644 --- a/drivers/regulator/pv88060-regulator.c +++ b/drivers/regulator/pv88060-regulator.c @@ -135,7 +135,7 @@ static int pv88060_set_current_limit(struct regulator_dev *rdev, int min, int i; /* search for closest to maximum */ - for (i = info->n_current_limits; i >= 0; i--) { + for (i = info->n_current_limits - 1; i >= 0; i--) { if (min <= info->current_limits[i] && max >= info->current_limits[i]) { return regmap_update_bits(rdev->regmap, -- 2.20.1