[PATCH] genirq: Avoid signed shift when probing IRQ 31

From: Avi Weiss

Date: Sun Nov 01 2026 - 02:05:47 EST


probe_irq_on() uses a signed int literal to set bits in an unsigned
long mask. For IRQ 31, the shift results in undefined behavior and
can set bits 32-63 on 64-bit systems.

Use UL suffix - promote to unsigned long so we set only the intended
IRQ bit. Current in-tree callers do not appear to use the affected
upper bits, but better to clean it up now for future correctness
and safety.

Signed-off-by: Avi Weiss <thnkslprpt@xxxxxxxxx>
---
kernel/irq/autoprobe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
index d0af8a8b3ae67..a46376373b3ea 100644
--- a/kernel/irq/autoprobe.c
+++ b/kernel/irq/autoprobe.c
@@ -88,7 +88,7 @@ unsigned long probe_irq_on(void)
desc->istate &= ~IRQS_AUTODETECT;
irq_shutdown_and_deactivate(desc);
} else if (i < 32) {
- mask |= 1 << i;
+ mask |= 1UL << i;
}
}
}
--
2.43.0