hv: lapic: fix MISRA-C violation of potential numeric overflow

This patch fixes the MISRA-C violations in arch/x86/lapic.c, change local variable from
uint32_t to uint64_t to avoid potential numeric overflow.

Tracked-On: #861
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yan, Like 2018-12-18 17:02:24 +08:00 committed by wenlingz
parent 83ebd43239
commit 08cf8f648c
1 changed files with 4 additions and 4 deletions

View File

@ -154,15 +154,15 @@ static void restore_lapic(const struct lapic_regs *regs)
void suspend_lapic(void)
{
uint32_t val;
uint64_t val;
saved_lapic_base_msr.value = msr_read(MSR_IA32_APIC_BASE);
save_lapic(&saved_lapic_regs);
/* disable APIC with software flag */
val = (uint32_t) msr_read(MSR_IA32_EXT_APIC_SIVR);
val = (~LAPIC_SVR_APIC_ENABLE_MASK) & val;
msr_write(MSR_IA32_EXT_APIC_SIVR, (uint64_t) val);
val = msr_read(MSR_IA32_EXT_APIC_SIVR);
val = (~(uint64_t)LAPIC_SVR_APIC_ENABLE_MASK) & val;
msr_write(MSR_IA32_EXT_APIC_SIVR, val);
}
void resume_lapic(void)