From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D8D8C43387 for ; Thu, 10 Jan 2019 08:26:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0CB2F2173B for ; Thu, 10 Jan 2019 08:26:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fdfbwHyj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0CB2F2173B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csie.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=GV6fymg5h4K4sRQwo8n0i+hxxJN9ROB6XdnZgkiGYUY=; b=fdfbwHyjYc5i2B 3emGvOvM4qmdN5fTTcX2pGoKD3iiuoL7h9cRIrcRvyRaUXU+rzgrprt1Vs3Gjct8JOvUuEn8RCWl7 kH7IqtBUgqK0kbceCZSpyO4Ml6BxWBt73O8p36DwTvNe2KaeysE4E7+P3dIWhlQiTdc+Ub4ypcx1l U+GgDSarVhrU5iE4XvzAFxtG6YWQOvDZrryR51Ok67DpmC2ZySdZHxq2NJ8OUsYkkcJwUiMiHyM0E jyShxBdvvngRLA8XR8Ht/9rgFRvmtzXOpRIVExOLlxJNdViCpt5lF9RYCvQfVXuBBI7mEaYLOPby4 DEVgmFV8NFGo3lUrgTww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghVg0-0004Mo-1B; Thu, 10 Jan 2019 08:26:56 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghVfg-00047N-WB for linux-arm-kernel@lists.infradead.org; Thu, 10 Jan 2019 08:26:39 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 160925FC23; Thu, 10 Jan 2019 16:26:34 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Linus Walleij Subject: [PATCH 1/2] pinctrl: sunxi: Increase size of regulator array Date: Thu, 10 Jan 2019 16:26:32 +0800 Message-Id: <20190110082633.6321-1-wens@csie.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190110_002637_184250_BD6A6096 X-CRM114-Status: GOOD ( 13.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-gpio@vger.kernel.org, Chen-Yu Tsai , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On the A80, the pin banks go up to PN, which translates to the 14th entry in the regulator array. The array is only 12 entries long, which causes the sunxi_pmx_{request,free} functions to access beyond the array on the A80 and the A31 (which has pin bank PM). While the accessed data is still valid allocated data within the same driver data structure, it is likely not a pointer. Increase the size of the regulator array from 12 to 14. This is a simple fix. While we could have the code take into account the fact that R_PIO pin banks start from PL, or maybe even dynamically allocate the array based on the last pin of the pin controller, the size reduction probably isn't worth the additional code complexity. Fixes: 9a2a566adb00 ("pinctrl: sunxi: Deal with per-bank regulators") Signed-off-by: Chen-Yu Tsai --- This fixes a crash due to an invalid pointer on the A80. --- drivers/pinctrl/sunxi/pinctrl-sunxi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h index e340d2a24b44..e8161aa17dab 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h @@ -136,7 +136,7 @@ struct sunxi_pinctrl { struct gpio_chip *chip; const struct sunxi_pinctrl_desc *desc; struct device *dev; - struct sunxi_pinctrl_regulator regulators[12]; + struct sunxi_pinctrl_regulator regulators[14]; struct irq_domain *domain; struct sunxi_pinctrl_function *functions; unsigned nfunctions; -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel