mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-08 20:29:40 +00:00
HV:fix potential buffer overflow issues
- use sizeof(struct lapic_regs),instead of arbitrary size to lear 'apic_page' memory region in vlapic.c - fix potential buffer overflow issues in vpic.c & ioapic.c Tracked-On: #1252 Signed-off-by: Yonghua Huang <yonghua.huang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -412,6 +412,10 @@ static void vpic_set_pinstate(struct acrn_vpic *vpic, uint8_t pin, bool newstate
|
||||
int oldcnt, newcnt;
|
||||
bool level;
|
||||
|
||||
if (pin >= NR_VPIC_PINS_TOTAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
i8259 = &vpic->i8259[pin >> 3U];
|
||||
|
||||
oldcnt = i8259->acnt[pin & 0x7U];
|
||||
@@ -457,6 +461,10 @@ static void vpic_set_irqstate(struct vm *vm, uint32_t irq,
|
||||
struct i8259_reg_state *i8259;
|
||||
uint8_t pin;
|
||||
|
||||
if (irq >= NR_VPIC_PINS_TOTAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
vpic = vm_pic(vm);
|
||||
i8259 = &vpic->i8259[irq >> 3U];
|
||||
pin = (uint8_t)irq;
|
||||
|
Reference in New Issue
Block a user