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:
Yonghua Huang
2018-09-18 17:44:09 +08:00
committed by lijinxia
parent b501ce4388
commit 994a375103
4 changed files with 42 additions and 105 deletions

View File

@@ -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;