]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
irqchip/xilinx: Fix shift out of bounds
authorRadhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Fri, 9 Aug 2024 07:02:24 +0000 (12:32 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Aug 2024 13:34:32 +0000 (15:34 +0200)
commit08b2670a8d061219bfae5e11cd0e8a5427c4e759
tree4df9fcfbb1f892f6b2736300e1d75a337247b364
parent267d1ae667cf156ff3e43b92a4a5f5325cc466e0
irqchip/xilinx: Fix shift out of bounds

commit d73f0f49daa84176c3beee1606e73c7ffb6af8b2 upstream.

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 interrupts the shift is out of bounds, resulting in
a mismatch warning. The out of bounds condition is also 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'

Fix it by promoting the mask to u64 for the test.

Fixes: d50466c90724 ("microblaze: intc: Refactor DT sanity check")
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/1723186944-3571957-1-git-send-email-radhey.shyam.pandey@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/irqchip/irq-xilinx-intc.c