genirq: Avoid signed shift when probing IRQ 31
PATCH 1/1 genirq: Avoid signed shift when probing IRQ 31
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 <[email protected]>
--- kernel/irq/autoprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/irq/autoprobe.c +1 -1
@@ -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; } } }
Signature · 1 line
2.43.0