diff mbox

[v2,12/14] target-arm: Fix bit test in sp_el0_access

Message ID 1407278474-17559-2-git-send-email-eblake@redhat.com
State New
Headers show

Commit Message

Eric Blake Aug. 5, 2014, 10:41 p.m. UTC
From: Stefan Weil <sw@weilnetz.de>

Static code analyzers complain about a dubious & operation used for a
boolean value. The code does not test the PSTATE_SP bit as it should.

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1406359601-25583-1-git-send-email-sw@weilnetz.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/target-arm/helper.c b/target-arm/helper.c
index a7f82f3..d709285 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -1853,7 +1853,7 @@  static uint64_t aa64_dczid_read(CPUARMState *env, const ARMCPRegInfo *ri)

 static CPAccessResult sp_el0_access(CPUARMState *env, const ARMCPRegInfo *ri)
 {
-    if (!env->pstate & PSTATE_SP) {
+    if (!(env->pstate & PSTATE_SP)) {
         /* Access to SP_EL0 is undefined if it's being used as
          * the stack pointer.
          */