Browse Source

drivers: intc_ioapic: Fix Out of Bounds shift

Hexadecimal integer literals are signed if they can fit into a signed int,
which causes undefined behavior.

This happens here because 0xFF can fit into a signed int and then gets
left-shifted by 24, undefined behavior for signed integers.

Signed-off-by: Daniel Hajjar <daniel.hajjar16@gmail.com>
pull/87587/head
Daniel Hajjar 4 months ago committed by Benjamin Cabé
parent
commit
a4e139b9f8
  1. 2
      drivers/interrupt_controller/intc_ioapic.c

2
drivers/interrupt_controller/intc_ioapic.c

@ -84,7 +84,7 @@ DEVICE_MMIO_TOPLEVEL_STATIC(ioapic_regs, DT_DRV_INST(0)); @@ -84,7 +84,7 @@ DEVICE_MMIO_TOPLEVEL_STATIC(ioapic_regs, DT_DRV_INST(0));
* In either case, regardless how many CPUs in the system, 0xff implies that
* it's intended to deliver to all possible 8 local APICs.
*/
#define DEFAULT_RTE_DEST (0xFF << 24)
#define DEFAULT_RTE_DEST (0xFFU << 24)
static __pinned_bss uint32_t ioapic_rtes;

Loading…
Cancel
Save