Skip to content

Commit 0c12f67

Browse files
DanTGLJeppe Odgaard
authored andcommitted
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 <[email protected]>
1 parent 1703064 commit 0c12f67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/interrupt_controller/intc_ioapic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ DEVICE_MMIO_TOPLEVEL_STATIC(ioapic_regs, DT_DRV_INST(0));
8484
* In either case, regardless how many CPUs in the system, 0xff implies that
8585
* it's intended to deliver to all possible 8 local APICs.
8686
*/
87-
#define DEFAULT_RTE_DEST (0xFF << 24)
87+
#define DEFAULT_RTE_DEST (0xFFU << 24)
8888

8989
static __pinned_bss uint32_t ioapic_rtes;
9090

0 commit comments

Comments
 (0)