[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] xen/x86: Avoid undefined behaviour by shifting into a sign bit
commit 71a8c219e8b7c61781f4c5a589cd8715050b9961 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Fri Aug 5 14:24:01 2016 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Thu Aug 11 10:09:01 2016 +0100 xen/x86: Avoid undefined behaviour by shifting into a sign bit Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/apic.c | 2 +- xen/arch/x86/cpu/common.c | 2 +- xen/arch/x86/x86_64/traps.c | 2 +- xen/include/asm-x86/apicdef.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index f3727cd..3fb9a82 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -571,7 +571,7 @@ void setup_local_APIC(void) for (i = APIC_ISR_NR - 1; i >= 0; i--) { value = apic_read(APIC_ISR + i*0x10); for (j = 31; j >= 0; j--) { - if (value & (1<<j)) + if (value & (1u << j)) ack_APIC_irq(); } } diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index 2c47589..577a01f 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -476,7 +476,7 @@ void detect_extended_topology(struct cpuinfo_x86 *c) sub_index++; } while ( LEAFB_SUBTYPE(ecx) != INVALID_TYPE ); - core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width; + core_select_mask = (~(~0u << core_plus_mask_width)) >> ht_mask_width; c->cpu_core_id = phys_pkg_id(initial_apicid, ht_mask_width) & core_select_mask; diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c index 19f58a1..2d8ecf5 100644 --- a/xen/arch/x86/x86_64/traps.c +++ b/xen/arch/x86/x86_64/traps.c @@ -414,7 +414,7 @@ void subarch_percpu_traps_init(void) unmap_domain_page(stub_page); /* Common SYSCALL parameters. */ - wrmsr(MSR_STAR, 0, (FLAT_RING3_CS32<<16) | __HYPERVISOR_CS); + wrmsr(MSR_STAR, 0, ((unsigned int)FLAT_RING3_CS32 << 16) | __HYPERVISOR_CS); wrmsr(MSR_SYSCALL_MASK, XEN_SYSCALL_MASK, 0U); } diff --git a/xen/include/asm-x86/apicdef.h b/xen/include/asm-x86/apicdef.h index 8752287..da7f4d3 100644 --- a/xen/include/asm-x86/apicdef.h +++ b/xen/include/asm-x86/apicdef.h @@ -30,7 +30,7 @@ #define APIC_EIO_ACK 0x0 /* Write this to the EOI register */ #define APIC_RRR 0xC0 #define APIC_LDR 0xD0 -#define APIC_LDR_MASK (0xFF<<24) +#define APIC_LDR_MASK (0xFFu<<24) #define GET_xAPIC_LOGICAL_ID(x) (((x)>>24)&0xFF) #define SET_xAPIC_LOGICAL_ID(x) (((x)<<24)) #define APIC_ALL_CPUS 0xFF -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |