summaryrefslogtreecommitdiffstats
path: root/hw/intc
diff options
context:
space:
mode:
authorPeter Maydell2014-03-17 17:00:40 +0100
committerMichael Tokarev2014-03-27 16:22:49 +0100
commit0bc60bd7b34ad6e59b47dbf91179ba9427a85df7 (patch)
tree149f10efad311812ea0549bde5d7692abfd420c0 /hw/intc
parenthw/intc/slavio_intctl: Avoid shifting left into sign bit (diff)
downloadqemu-0bc60bd7b34ad6e59b47dbf91179ba9427a85df7.tar.gz
qemu-0bc60bd7b34ad6e59b47dbf91179ba9427a85df7.tar.xz
qemu-0bc60bd7b34ad6e59b47dbf91179ba9427a85df7.zip
hw/intc/xilinx_intc: Avoid shifting left into sign bit
Avoid undefined behaviour shifting left into the sign bit. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw/intc')
-rw-r--r--hw/intc/xilinx_intc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/intc/xilinx_intc.c b/hw/intc/xilinx_intc.c
index 4a103988f3..1b228ff4e0 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;