linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] irqchip/xilinx: fix shift out of bounds warning
@ 2024-08-08  7:24 Radhey Shyam Pandey
  2024-08-08 14:57 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Radhey Shyam Pandey @ 2024-08-08  7:24 UTC (permalink / raw)
  To: tglx, michal.simek
  Cc: linux-kernel, linux-arm-kernel, git, Radhey Shyam Pandey

In case num_irq is 32 there is shift out of bound and result in false
warning "irq-xilinx: mismatch in kind-of-intr param" . To fix it cast
intr_mask to u64. It also fixes below shift out of bound warning
reported by UBSAN.

UBSAN: shift-out-of-bounds in irq-xilinx-intc.c:332:22
shift exponent 32 is too large for 32-bit type 'unsigned int'

Fixes: d50466c90724 ("microblaze: intc: Refactor DT sanity check")
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
---
 drivers/irqchip/irq-xilinx-intc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c
index 238d3d344949..7e08714d507f 100644
--- a/drivers/irqchip/irq-xilinx-intc.c
+++ b/drivers/irqchip/irq-xilinx-intc.c
@@ -189,7 +189,7 @@ static int __init xilinx_intc_of_init(struct device_node *intc,
 		irqc->intr_mask = 0;
 	}
 
-	if (irqc->intr_mask >> irqc->nr_irq)
+	if ((u64)irqc->intr_mask >> irqc->nr_irq)
 		pr_warn("irq-xilinx: mismatch in kind-of-intr param\n");
 
 	pr_info("irq-xilinx: %pOF: num_irq=%d, edge=0x%x\n",

base-commit: 6a0e38264012809afa24113ee2162dc07f4ed22b
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-08 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08  7:24 [PATCH] irqchip/xilinx: fix shift out of bounds warning Radhey Shyam Pandey
2024-08-08 14:57 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).