Skip to content

Commit 24f989c

Browse files
enjiamaicarlescufi
authored andcommitted
drivers: ioapic: fix the cast for the offset
The cast for the offset variable will make incorrect register access when it is over 0x80. Change the char cast to unsigned char to fix it. Fixes #49803. Signed-off-by: Enjia Mai <[email protected]>
1 parent 933a987 commit 24f989c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/interrupt_controller/intc_ioapic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ static uint32_t __IoApicGet(int32_t offset)
438438

439439
key = irq_lock();
440440

441-
*((volatile uint32_t *) (IOAPIC_REG + IOAPIC_IND)) = (char)offset;
441+
*((volatile uint32_t *) (IOAPIC_REG + IOAPIC_IND)) = (unsigned char)offset;
442442
value = *((volatile uint32_t *)(IOAPIC_REG + IOAPIC_DATA));
443443

444444
irq_unlock(key);
@@ -463,7 +463,7 @@ static void __IoApicSet(int32_t offset, uint32_t value)
463463

464464
key = irq_lock();
465465

466-
*(volatile uint32_t *)(IOAPIC_REG + IOAPIC_IND) = (char)offset;
466+
*(volatile uint32_t *)(IOAPIC_REG + IOAPIC_IND) = (unsigned char)offset;
467467
*((volatile uint32_t *)(IOAPIC_REG + IOAPIC_DATA)) = value;
468468

469469
irq_unlock(key);

0 commit comments

Comments
 (0)