| Message ID | 20260910133519.459011-7-andre.przywara@arm.com (mailing list archive) |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-sunxi+bounces-25805-sunxi=pue.re@lists.linux.dev> X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mxe881.netcup.net (Postfix) with ESMTPS id B23721C0774 for <noreply@patchwork.local>; Thu, 10 Sep 2026 15:54:10 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=arm.com; spf=pass (sender IP is 172.234.253.10) smtp.mailfrom=linux-sunxi+bounces-25805-noreply=patchwork.local@lists.linux.dev smtp.helo=sea.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.234.253.10 as permitted sender) client-ip=172.234.253.10; envelope-from=linux-sunxi+bounces-25805-noreply=patchwork.local@lists.linux.dev; helo=sea.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id CC84964939 for <noreply@patchwork.local>; Thu, 10 Sep 2026 13:41:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6810F4A2634; Thu, 10 Sep 2026 13:35:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="TMigpWmV" X-Original-To: linux-sunxi@lists.linux.dev Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E4D94A2065 for <linux-sunxi@lists.linux.dev>; Thu, 10 Sep 2026 13:35:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789047345; cv=none; b=EEmckcjABwHURe1YWXfelEeubc4ywN/lL6osVMtAwDD6fTj2tQg2r+7y3rvGBSOQ4JXEoeZNVD98bt9mm73vdvWZG6mTuXOOpVbKDZC0OETH3ZYij72yhEr0O4ygIzVvPfoVOjxgnIsMLX3RK1hDiEmgkj/vSdmd7irVirquU7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789047345; c=relaxed/simple; bh=vFiGko9W5vY2zPx9uystmT+pgsJatJ921+bOqjDFnsw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t8E6PQ1B/D1RwW6sV7L8EQtlJOB4BVlLpW8qoVeXvEn1008IKYlvoed9d+y/dfJ3jRngjvdcfVH/i0gEE50Ga+FYM6yLzn/ObZ8+OQKdhthlrIy1Ibn/8pPFHQ6iT0th0ps/f+u1H0KvyuSjtPa10HjzmKx4cOJnxr6xlDoLDpw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=TMigpWmV; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6BD5322C8; Thu, 10 Sep 2026 06:35:39 -0700 (PDT) Received: from e142021.fritz.box (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 801593F528; Thu, 10 Sep 2026 06:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1789047343; bh=vFiGko9W5vY2zPx9uystmT+pgsJatJ921+bOqjDFnsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TMigpWmVs+gqlwFfSICdSaAmeo6lDUIvUP6cV9HfrbQt55FN6fTzomymOP19U3v9J f6VS/cUdGXCOgakdg9hL8rw6vkvhAOCtOPHpv2tmQbRYrLHCKE3+EGZOdPbMKr6CaC Njqm5G9HmtqPDwAg+e3/s/nDqc31iNGz9UqrHa3A= From: Andre Przywara <andre.przywara@arm.com> To: Linus Walleij <linusw@kernel.org>, Rob Herring <robh@kernel.org>, Krzysztof Kozlowski <krzk+dt@kernel.org>, Conor Dooley <conor+dt@kernel.org>, Chen-Yu Tsai <wens@kernel.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org> Cc: Jerome Brunet <jbrunet@baylibre.com>, Yixun Lan <dlan@gentoo.org>, Enzo Adriano <enzo.adriano.code@gmail.com>, Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH 6/7] pinctrl: sunxi: a523-r: add a733-r compatible string Date: Thu, 10 Sep 2026 15:35:17 +0200 Message-ID: <20260910133519.459011-7-andre.przywara@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260910133519.459011-1-andre.przywara@arm.com> References: <20260910133519.459011-1-andre.przywara@arm.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: <linux-sunxi.lists.linux.dev> List-Subscribe: <mailto:linux-sunxi+subscribe@lists.linux.dev> List-Unsubscribe: <mailto:linux-sunxi+unsubscribe@lists.linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [-0.66 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[172.234.253.10:from]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; MAILLIST(-0.15)[generic]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; TAGGED_RCPT(0.00)[dt]; FROM_HAS_DN(0.00)[]; PRECEDENCE_BULK(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWELVE(0.00)[15]; FREEMAIL_CC(0.00)[baylibre.com,gentoo.org,gmail.com,vger.kernel.org,lists.infradead.org,lists.linux.dev]; DBL_BLOCKED_OPENRESOLVER(0.00)[arm.com:email,arm.com:dkim,sea.lore.kernel.org:rdns,sea.lore.kernel.org:helo]; FORGED_SENDER_MAILLIST(0.00)[]; R_DKIM_ALLOW(0.00)[arm.com:s=foss]; RCVD_COUNT_FIVE(0.00)[6]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; DKIM_TRACE(0.00)[arm.com:+]; DMARC_POLICY_ALLOW(0.00)[arm.com,none]; R_SPF_ALLOW(0.00)[+ip4:172.234.253.10]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[217.140.110.172:received,100.90.174.1:received]; TO_DN_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[andre.przywara@arm.com,linux-sunxi@lists.linux.dev]; FREEMAIL_TO(0.00)[kernel.org,gmail.com,sholland.org]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[bounces-25805-noreply=patchwork.local]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; ASN(0.00)[asn:63949, ipnet:172.234.224.0/19, country:SG]; RCVD_TLS_LAST(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[172.234.253.10:from] X-Rspamd-Queue-Id: B23721C0774 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= |
| Series |
pinctrl: sunxi: Add Allwinner A733 support
|
|
Commit Message
Andre Przywara
Sept. 10, 2026, 1:35 p.m. UTC
The secondary Allwinner A733 pincontroller ("-r") is interestingly not
using the same new MMIO frame layout as the main controller, but is in
fact very similar to the A523-r one: it has two banks, with 14 and 6 pins
each. From the driver's perspective, this is all we care about, so we can
re-use the a523-r pinctrl driver for the a733-r, too.
The individual pinmux settings are different, so we must not use the
a523-r compatible string as a fallback, but we can surely let the same
driver care for both the a523-r and a733-r IP, as the pinmux values will
be provided by the DT.
Add the a733-r compatible string to the match list, without further
distinguishing between the two. Should differences be discovered later,
we can easily split this up then.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c | 1 +
1 file changed, 1 insertion(+)
Comments
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: Pre-existing issues: - [High] This problem wasn't introduced by this patch, but the static `desc->npins` counter accumulates on probe deferral, causing out-of-bounds array reads with negative indices. -- commit 0f0363ee56222ed4bd5f82e32e391a15a8e11f99 Author: Andre Przywara <andre.przywara@arm.com> pinctrl: sunxi: a523-r: add a733-r compatible string Adds the allwinner,sun60i-a733-r-pinctrl compatible string to the A523-r pinctrl driver. The driver is reused for the A733-r IP since it shares a similar two-bank layout, with specific pinmux values provided by the DT. > diff --git a/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c b/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c > index 9e07fbb5be7cb..dfdcfa740ecc9 100644 > --- a/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c > +++ b/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c > @@ -40,6 +40,7 @@ static int a523_r_pinctrl_probe(struct platform_device *pdev) > > static const struct of_device_id a523_r_pinctrl_match[] = { > { .compatible = "allwinner,sun55i-a523-r-pinctrl", }, > + { .compatible = "allwinner,sun60i-a733-r-pinctrl", }, [Severity: High] This isn't a bug introduced by this patch, but does the static desc->npins counter accumulate on probe deferral, causing out-of-bounds array reads with negative indices? When the driver is probed, it passes the statically allocated a523_r_pinctrl_data to sunxi_pinctrl_dt_table_init(). In drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c:init_pins_table(): for (i = 0; i < SUNXI_PINCTRL_MAX_BANKS; i++) { desc->npins += pins_per_bank[i]; If the probe fails later (e.g., -EPROBE_DEFER), desc->npins is not reset. On the next probe, it increments again, allocating a larger array but only initializing the first valid elements. Then prepare_function_table() iterates up to the accumulated desc->npins: for (i = 0; i < npins; i++) { struct sunxi_desc_pin *pin = &pins[i]; int bank = (pin->pin.number - pin_base) / PINS_PER_BANK; if (irq_bank_muxes[bank]) { For uninitialized pins, pin->pin.number is 0. With a pin_base like 352 (PL_BASE), the bank index becomes (0 - 352) / 32 = -11. This results in an out-of-bounds access irq_bank_muxes[-11]. Furthermore, searching for a non-existent DT pin name will scan into the uninitialized elements, calling strcmp(NULL, name) and potentially panicking the kernel. > {} > };
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c b/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c index 9e07fbb5be7cb..dfdcfa740ecc9 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c +++ b/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c @@ -40,6 +40,7 @@ static int a523_r_pinctrl_probe(struct platform_device *pdev) static const struct of_device_id a523_r_pinctrl_match[] = { { .compatible = "allwinner,sun55i-a523-r-pinctrl", }, + { .compatible = "allwinner,sun60i-a733-r-pinctrl", }, {} };