diff mbox

[PULL,20/23] hw/intc/xilinx_intc: Avoid shifting left into sign bit

Message ID 1395934108-1694-21-git-send-email-mjt@msgid.tls.msk.ru
State Accepted
Commit 0bc60bd7b34ad6e59b47dbf91179ba9427a85df7
Headers show

Commit Message

Michael Tokarev March 27, 2014, 3:28 p.m. UTC
From: Peter Maydell <peter.maydell@linaro.org>

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>
---
 hw/intc/xilinx_intc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/hw/intc/xilinx_intc.c b/hw/intc/xilinx_intc.c
index 4a10398..1b228ff 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;