From patchwork Thu Feb 14 01:36:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Masney X-Patchwork-Id: 10811561 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30C0D922 for ; Thu, 14 Feb 2019 01:37:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15AE5286A0 for ; Thu, 14 Feb 2019 01:37:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0952E2D22B; Thu, 14 Feb 2019 01:37:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEAC4286A0 for ; Thu, 14 Feb 2019 01:37:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389030AbfBNBg5 (ORCPT ); Wed, 13 Feb 2019 20:36:57 -0500 Received: from onstation.org ([52.200.56.107]:37246 "EHLO onstation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389149AbfBNBg4 (ORCPT ); Wed, 13 Feb 2019 20:36:56 -0500 Received: from localhost.localdomain (c-98-239-145-235.hsd1.wv.comcast.net [98.239.145.235]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: masneyb) by onstation.org (Postfix) with ESMTPSA id B14CF1F3; Thu, 14 Feb 2019 01:36:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=onstation.org; s=default; t=1550108215; bh=0g9/fEdwyhLjguANKSGMD3dHhaqWJUvUAbCu9zdQ6dc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pG14xrSUyknxiZtvn4z8YkAVtcCElWMkhs/cV9WOgwqPnc3a9Nz0bPjhg7FsJ+eFt yj4UTqCPqcq0TJV8D/n8KtNgbKI4YxmnQ7fXHCCEtkpvboTkyczXXsBirKipNqe83F N2PT7WXQnfvZ0lQvdA3qyMNqBh8vhiVRGnZxAGJE= From: Brian Masney To: linus.walleij@linaro.org Cc: sboyd@kernel.org, lee.jones@linaro.org, andy.gross@linaro.org, david.brown@linaro.org, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH -next 3/3] qcom: ssbi-gpio: correct boundary conditions in pm8xxx_domain_translate Date: Wed, 13 Feb 2019 20:36:41 -0500 Message-Id: <20190214013641.9740-3-masneyb@onstation.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190214013641.9740-1-masneyb@onstation.org> References: <20190214013641.9740-1-masneyb@onstation.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP SSBI GPIOs are numbered 1..ngpio, so the boundary check in pm8xxx_domain_translate() is off by one. This patch corrects that check. Signed-off-by: Brian Masney --- Originally found by Bjorn Andersson in spmi-gpio. Linus: For your ib-qcom-ssbi branch. drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c index 84a232450000..10575d6e2ba5 100644 --- a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c +++ b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c @@ -710,7 +710,8 @@ static int pm8xxx_domain_translate(struct irq_domain *domain, struct pm8xxx_gpio *pctrl = container_of(domain->host_data, struct pm8xxx_gpio, chip); - if (fwspec->param_count != 2 || fwspec->param[0] >= pctrl->chip.ngpio) + if (fwspec->param_count != 2 || fwspec->param[0] < 1 || + fwspec->param[0] > pctrl->chip.ngpio) return -EINVAL; *hwirq = fwspec->param[0] - PM8XXX_GPIO_PHYSICAL_OFFSET;