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: 10807301 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 7B646746 for ; Tue, 12 Feb 2019 03:52:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 680EF2B25E for ; Tue, 12 Feb 2019 03:52:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BF342B2DB; Tue, 12 Feb 2019 03:52:08 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 011D32B2CB for ; Tue, 12 Feb 2019 03:52:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727208AbfBLDwB (ORCPT ); Mon, 11 Feb 2019 22:52:01 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39740 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727166AbfBLDwB (ORCPT ); Mon, 11 Feb 2019 22:52:01 -0500 Received: by mail-pg1-f195.google.com with SMTP id r11so590970pgp.6 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=LMUhpj480LULwMRu3emVRMD+KniW6UwDTKiS4IbSnczhaFIdsorO3G8SK3ICS81fDJ QpPeMXlhUDBqbxgoQlH/jnhlRrx9yMxQjz3GxhJhoVYjrNhr/GYM1GWG+rNXBcISwA2t H2XtOuYpJ5nY9vQVMNwFNXesLGNFbsfcP1IQFTqz+w2URnjKvn0irCYwYHji9CPh5y4I XCTnqJfqSkzxZT4ybN9e7m3xcr9om8wnDbQ1XSkwhuEXkZh5UGWT49wYxXO85ibaCJr3 F19sDamGTIuFA6Afon287K2mPfcYYgB6KZfPqqvZpr1dqezXcJFH2q4sms4yAI/uzXRB d/2g== X-Gm-Message-State: AHQUAual7tY87oM1BJOsXlRgdUASZ0yfyNT5dm4amvlT+Ckp8zAgw6NR +AmOs/L2jCwvfuE5jM3ebkNEzQ== X-Google-Smtp-Source: AHgI3IZHX18AzaQOVLSpHAkcDO03lmNTkvZBqwuY4k4MZHIx7Js6XgCG2GzIh1KOaWCjLRpxnZJQqw== 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-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 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 Reviewed-by: Brian Masney --- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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;