Skip to content

Commit

Permalink
target/s390x/tcg/mem_helper: Test the right bits in psw_key_valid()
Browse files Browse the repository at this point in the history
The PSW key mask is a 16 bit field, and the psw_key variable is
in the range from 0 to 15, so it does not make sense to use
"0x80 >> psw_key" for testing the bits here. We should use 0x8000
instead.

Message-Id: <[email protected]>
Reviewed-by: Nina Schoetterl-Glausch <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
  • Loading branch information
huth committed Dec 15, 2022
1 parent 0345195 commit 5e275ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion target/s390x/tcg/mem_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static inline bool psw_key_valid(CPUS390XState *env, uint8_t psw_key)

if (env->psw.mask & PSW_MASK_PSTATE) {
/* PSW key has range 0..15, it is valid if the bit is 1 in the PKM */
return pkm & (0x80 >> psw_key);
return pkm & (0x8000 >> psw_key);
}
return true;
}
Expand Down

0 comments on commit 5e275ca

Please sign in to comment.