From patchwork Tue Feb 12 03:52:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 158065 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3368263jaa; Mon, 11 Feb 2019 19:52:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IZIo66UDF6nDXOIJjnLGXyMw40et1eYmXR5MpPz7pJH68+VRMGuBD9q6RkRc2rglufGI8vI X-Received: by 2002:a65:5844:: with SMTP id s4mr1682211pgr.77.1549943523874; Mon, 11 Feb 2019 19:52:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549943523; cv=none; d=google.com; s=arc-20160816; b=WnlKm23Upz8ucplliudIYSbn4RU5dvLHGsKBN5bPt7RcBNbT54Yc5WPsUYrhHH0oFB aBsQrsoj/H7sC1YOr+vLknT2st4bOt/PXQ5XsmPX1ZgUQ0bWex7qbp8rSj5L2dloJnIc 9GW/niCLrJdXIz+eknYbiDpO9YJgeW3Hkybrze3cZwz95bAhwJJW88AeLaTDQVDGeZMp f62qzNxDBhkM2t/miYtTKHgQP1FeMx09vXKl9YrPcRSa8bdFiQUUagx4ur36XLmD/RG8 IFiccYjSeZ7FB+bRTkknmSR8hfmbC+Vk91jVFmAbj1C17FE1r1rYAMhI+bZ/BtS1NUKL o63Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=yNNbD6//shUgVJDqF6KkOVva8DupadW9tZS+I+T4ju8=; b=SfG5dpojUmcT1llSAYFBuzEtrO3Htt0uQ4VTl5sLTxumPpVKxQvu6TQDvwqk+Vqo4+ 7jSpt9T42oXzgLZo3qQ96K0cn2NxF3ytJsJdd2RNs1UPcj+cmV4Li+sxpHlCLlES2x3a 6KGoQkFSf54mDFhh6OWKV04Yl6pTaw2tt2ul7Sei57XWwajNH+PkgJu6eMWlhKp9zdOO e8ANhnrWhlpos+Zj6e0N3zmSpzT4b/3FZCvE+NAKIvb2fn0Qs8CbqR833SexSRt9rPet XVNH10TF3VNukbUDDZKKIXV/5t11FbhnKaL8svgdSRIyWbBbIhi5a0mHt6FEHw4gu/xI V99Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i+cDA7H9; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o22si12179428pfk.38.2019.02.11.19.52.03; Mon, 11 Feb 2019 19:52:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-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=@linaro.org header.s=google header.b=i+cDA7H9; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727231AbfBLDwC (ORCPT + 5 others); Mon, 11 Feb 2019 22:52:02 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:34156 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727045AbfBLDwB (ORCPT ); Mon, 11 Feb 2019 22:52:01 -0500 Received: by mail-pf1-f195.google.com with SMTP id j18so627221pfe.1 for ; Mon, 11 Feb 2019 19:52:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=yNNbD6//shUgVJDqF6KkOVva8DupadW9tZS+I+T4ju8=; b=i+cDA7H9QfmewUC29F2PK07rfP/QTMGy++9SRwsK9yFiSU1r16P0XzVUD3wORds3NP R6ZlyvdugRISarS8v0HVuAjhSekp/JxCjnjLOX9WcIa5hjTqRLUiNRfFLbR15oUw80XM CfswiSZZ+56c1W3eKtlmB35L9Ni5sK/cVAfTR6Pi//CtMSJUxeSwA++UouyawNeHftk0 IEHc4AgRZfTQYrYkoHcKtbPLeT519oBvHLwB0IwKgEI9g+fAdXejFxKoSnYRLxJDgfLP fZOLe4fPBXADSsyLaDjD2sAx89ZC5zv+oseaZSu7HOaC/rQKN2eq9XCpE9VhaRvgEk/1 blLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yNNbD6//shUgVJDqF6KkOVva8DupadW9tZS+I+T4ju8=; b=HqhhDpXsNvbuUMEnTsqH4dOjiGXGg8yP2GcFTVnB8Ill7mPRBQD8IllT0uOrqamio/ wylIQl6q3g3dWaiE29Q0NQxNe2vsrri/0jQCpnk46PXwvVBV/w3hTzDaLT2r6vY1frgH EIfp8lKrg4gDBiw4o9HtTaDDYkfZR24yHUB3jwP7a02bk1TE6DGrUYycNW+KlOwAkFc5 kPcKzvKANOOWiDDKdtlY3jIb7n7C0O/sM/TlWrcCiWClD1iix+ULAen3Y7JnN1Ybf7Kj +wp1TTZM1KA7w9e87Vr4Nq14/m+YgzGESRe94khlDuiKUru+X7UCE4NzuudeLZofEtDK aQ2w== X-Gm-Message-State: AHQUAuZSzwDRocJaCO2bg/q5tehTF8ANyWYjzO7gdewJBseWkkVN0y90 9dk4f/rfK/GRr5wFPVmihWLQWQ== X-Received: by 2002:a62:28c9:: with SMTP id o192mr1871984pfo.57.1549943520323; Mon, 11 Feb 2019 19:52:00 -0800 (PST) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id m3sm20311131pfi.102.2019.02.11.19.51.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 19:51:59 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Linus Walleij , Brian Masney Cc: linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] qcom: spmi-gpio: Fix boundary conditions IRQ domain translate Date: Mon, 11 Feb 2019 19:52:05 -0800 Message-Id: <20190212035205.23477-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org GPIOs on the SPMI PMIC are numbered 1..ngpio, so the boundary check in pmic_gpio_domain_translate() is off by one, correct this. Fixes: ca69e2d165eb ("qcom: spmi-gpio: add support for hierarchical IRQ chip") Signed-off-by: Bjorn Andersson --- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.18.0 Reviewed-by: Brian Masney diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c index e01a556ac586..cb512c7a5251 100644 --- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c @@ -962,7 +962,8 @@ static int pmic_gpio_domain_translate(struct irq_domain *domain, struct pmic_gpio_state, chip); - if (fwspec->param_count != 2 || fwspec->param[0] >= state->chip.ngpio) + if (fwspec->param_count != 2 || + fwspec->param[0] < 1 || fwspec->param[0] > state->chip.ngpio) return -EINVAL; *hwirq = fwspec->param[0] - PMIC_GPIO_PHYSICAL_OFFSET;