[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150128012637.297311475@linuxfoundation.org>
Date:	Tue, 27 Jan 2015 17:26:15 -0800
From:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:	linux-kernel@...r.kernel.org
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	stable@...r.kernel.org, Timur Tabi <timur@...eaurora.org>,
	Pramod Gurav <pramod.gurav@...rtplayin.com>,
	Bjorn Andersson <bjorn.andersson@...ymobile.com>,
	"Ivan T. Ivanov" <iivanov@...sol.com>,
	Andy Gross <agross@...eaurora.org>,
	Stephen Boyd <sboyd@...eaurora.org>,
	Linus Walleij <linus.walleij@...aro.org>
Subject: [PATCH 3.18 03/61] pinctrl: qcom: Dont iterate past end of function array
3.18-stable review patch.  If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <sboyd@...eaurora.org>
commit bcd53f858d87f52843cc87764b283999126a50d6 upstream.
Timur reports that this code crashes if nfunctions is 0. Fix the
loop iteration to only consider valid elements of the functions
array.
Reported-by: Timur Tabi <timur@...eaurora.org>
Cc: Pramod Gurav <pramod.gurav@...rtplayin.com>
Cc: Bjorn Andersson <bjorn.andersson@...ymobile.com>
Cc: Ivan T. Ivanov <iivanov@...sol.com>
Cc: Andy Gross <agross@...eaurora.org>
Fixes: 327455817a92 "pinctrl: qcom: Add support for reset for apq8064"
Signed-off-by: Stephen Boyd <sboyd@...eaurora.org>
Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
 drivers/pinctrl/qcom/pinctrl-msm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -865,10 +865,10 @@ static int msm_ps_hold_restart(struct no
 
 static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl)
 {
-	int i = 0;
+	int i;
 	const struct msm_function *func = pctrl->soc->functions;
 
-	for (; i <= pctrl->soc->nfunctions; i++)
+	for (i = 0; i < pctrl->soc->nfunctions; i++)
 		if (!strcmp(func[i].name, "ps_hold")) {
 			pctrl->restart_nb.notifier_call = msm_ps_hold_restart;
 			pctrl->restart_nb.priority = 128;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists