[PATCH v3] irqchip/gic: Fix UBSAN shift-out-of-bounds in GIC helpers

Marc Zyngier maz at kernel.org
Thu Sep 24 10:48:02 PDT 2026


On Wed, 23 Sep 2026 09:28:04 +0100,
Zhu Ling <zhuling2709 at phytium.com.cn> wrote:
> 
> When running with UBSAN enabled, enabling a GPIO controller that uses a
> GIC interrupt as its parent triggers several shift-out-of-bounds warnings:
> 
>   shift-out-of-bounds in drivers/irqchip/irq-gic-common.c:50:21
>   left shift of 2 by 30 places cannot be represented in type 'int'
> 
> Similar reports are emitted from gic_poke_irq() and gic_peek_irq() in
> drivers/irqchip/irq-gic-v3.c. The corresponding GICv2 helpers use the
> same signed-shift pattern. These masks are generated by shifting signed
> integer constants, which invokes undefined behavior when bit 31 is
> selected.
> 
> Use BIT() to generate the masks with an unsigned type and make their
> intent explicit.
> 
> Signed-off-by: Zhu Ling <zhuling2709 at phytium.com.cn>

Acked-by: Marc Zyngier <maz at kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list