* [PATCH] regmap: irq: fix incorrect index calculation for read_sub_irq_data()
@ 2026-10-20 13:39 Qinguang Xu via B4 Relay
2026-10-21 16:53 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Qinguang Xu via B4 Relay @ 2026-10-20 13:39 UTC (permalink / raw)
To: Mark Brown, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich
Cc: linux-kernel, driver-core, Qinguang Xu
From: Qinguang Xu <guang.cy2023@gmail.com>
While working on a PMIC driver that utilizes num_main_regs > 1, this
issue was noticed. Currently, no in-tree driver sets `num_main_regs >
1`, so this bug has not been triggered in practice.
Pass the global index calculated with `i` instead of the local bit
offset `b` to read_sub_irq_data().
Fix an off-by-one error in the index bounds check.
This patch has been compile-tested only.
Signed-off-by: Qinguang Xu <guang.cy2023@gmail.com>
---
drivers/base/regmap/regmap-irq.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 99b55b105..e151c6222 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -398,14 +398,14 @@ static int read_irq_data(struct regmap_irq_chip_data *data)
/* Read sub registers with active IRQs */
for (i = 0; i < chip->num_main_regs; i++) {
- unsigned int b;
+ unsigned int b, index;
const unsigned long mreg = data->main_status_buf[i];
for_each_set_bit(b, &mreg, map->format.val_bytes * 8) {
- if (i * map->format.val_bytes * 8 + b >
- max_main_bits)
+ index = i * map->format.val_bytes * 8 + b;
+ if (index >= max_main_bits)
break;
- ret = read_sub_irq_data(data, b);
+ ret = read_sub_irq_data(data, index);
if (ret != 0) {
dev_err(map->dev, "Failed to read IRQ status %d\n", ret);
---
base-commit: 4056b3c9d3c92ea45955641dbafeb9b960e146ef
change-id: 20261020-debug-6bee55638a91
Best regards,
--
Qinguang Xu <guang.cy2023@gmail.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] regmap: irq: fix incorrect index calculation for read_sub_irq_data()
2026-10-20 13:39 [PATCH] regmap: irq: fix incorrect index calculation for read_sub_irq_data() Qinguang Xu via B4 Relay
@ 2026-10-21 16:53 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-10-21 16:53 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Qinguang Xu
Cc: linux-kernel, driver-core
On Tue, 20 Oct 2026 21:39:06 +0800, Qinguang Xu wrote:
> regmap: irq: fix incorrect index calculation for read_sub_irq_data()
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-7.4
Thanks!
[1/1] regmap: irq: fix incorrect index calculation for read_sub_irq_data()
https://git.kernel.org/broonie/regmap/c/1ea2927c1bc3
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-22 14:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-20 13:39 [PATCH] regmap: irq: fix incorrect index calculation for read_sub_irq_data() Qinguang Xu via B4 Relay
2026-10-21 16:53 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox