[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN PATCH] x86/apic: Fix signing in left bitshift



There exists a bitshift in the IOAPIC code where a signed integer is
shifted to the left by at most 31 bits. This is undefined behaviour,
and can cause faults in xtf tests such as pv64-pv-iopl~hypercall.

This patch fixes this by changing the integer from signed to unsigned.

Signed-off-by: Matthew Barnes <matthew.barnes@xxxxxxxxx>
---
 xen/arch/x86/io_apic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index b48a64246548..ae88b1b898fe 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1756,7 +1756,7 @@ static void cf_check end_level_ioapic_irq_new(struct 
irq_desc *desc, u8 vector)
          !io_apic_level_ack_pending(desc->irq) )
         move_native_irq(desc);
 
-    if (!(v & (1 << (i & 0x1f)))) {
+    if (!(v & (1U << (i & 0x1f)))) {
         spin_lock(&ioapic_lock);
         __mask_IO_APIC_irq(desc->irq);
         __edge_IO_APIC_irq(desc->irq);
-- 
2.34.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.