From: Peter Maydell Date: Mon, 17 Mar 2014 16:00:40 +0000 (+0000) Subject: hw/intc/xilinx_intc: Avoid shifting left into sign bit X-Git-Tag: qemu-xen-4.5.0-rc1~72^2~3 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0bc60bd7b34ad6e59b47dbf91179ba9427a85df7;p=qemu-upstream-4.5-testing.git hw/intc/xilinx_intc: Avoid shifting left into sign bit Avoid undefined behaviour shifting left into the sign bit. Signed-off-by: Peter Maydell Signed-off-by: Michael Tokarev --- diff --git a/hw/intc/xilinx_intc.c b/hw/intc/xilinx_intc.c index 4a103988f..1b228ff4e 100644 --- a/hw/intc/xilinx_intc.c +++ b/hw/intc/xilinx_intc.c @@ -71,8 +71,9 @@ static void update_irq(struct xlx_pic *p) /* Update the vector register. */ for (i = 0; i < 32; i++) { - if (p->regs[R_IPR] & (1 << i)) + if (p->regs[R_IPR] & (1U << i)) { break; + } } if (i == 32) i = ~0;