Re: [PATCH] irqchip/xilinx: fix shift out of bounds warning
From: Thomas Gleixner
Date: Thu Aug 08 2024 - 10:58:00 EST
On Thu, Aug 08 2024 at 12:54, Radhey Shyam Pandey wrote:
irqchip/xilinx: fix shift out of bounds warning
Please start the sentence after the colon with an upper case letter.
Also you can't fix a out of bound warning. You can fix the code which
causes the warning
> In case num_irq is 32 there is shift out of bound and result in false
What is num_irq? This is text and not subject to random acronyms.
https://www.kernel.org/doc/html/latest/process/maintainer-tip.html
> 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'
Something like this:
irqchip/xilinx: Fix shift out of bounds
The device tree property 'xlnx,kind-of-intr' is sanity checked that
the bitmask contains only set bits which are in the range of the
number of interrupts supported by the controller.
The check is done by shifting the mask right by the number of
supported interrupts and checking the result for zero.
The data type of the mask is u32 and the number of supported
interrupts is up to 32. In case of 32 interrupt the shift is out of
bounds, resulting in a mismatch warning. The out of bounds condition
was also caught by UBSAN.
Fix it by promoting the mask to u64 for the test.
Hmm?
Thanks,
tglx