mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] genirq: Avoid signed shift when probing IRQ 31
@ 2026-11-01  7:05 Avi Weiss
  0 siblings, 0 replies; only message in thread
From: Avi Weiss @ 2026-11-01  7:05 UTC (permalink / raw)
  To: tglx; +Cc: radu, linux-kernel, Avi Weiss

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@gmail.com>
---
 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-01  7:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-01  7:05 [PATCH] genirq: Avoid signed shift when probing IRQ 31 Avi Weiss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®