From: David Hildenbrand <david@redhat.com>
To: Thomas Huth <thuth@redhat.com>,
qemu-devel@nongnu.org,
Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich <iii@linux.ibm.com>
Subject: Re: [PATCH for-8.0] target/s390x/tcg/mem_helper: Test the right bits in psw_key_valid()
Date: Mon, 5 Dec 2022 15:31:53 +0100 [thread overview]
Message-ID: <7b530181-3cd9-24c8-541a-86502d41693e@redhat.com> (raw)
In-Reply-To: <20221205142043.95185-1-thuth@redhat.com>
On 05.12.22 15:20, Thomas Huth wrote:
> 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.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> Found by code inspection (Linux likely does not use these PSW key masks
> yet, otherwise we might have noticed earlier)
>
> target/s390x/tcg/mem_helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c
> index 9542fad59b..cb82cd1c1d 100644
> --- a/target/s390x/tcg/mem_helper.c
> +++ b/target/s390x/tcg/mem_helper.c
> @@ -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;
> }
I assume a Fixes tag might be applicable (I remember I added that once).
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2022-12-05 14:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-05 14:20 [PATCH for-8.0] target/s390x/tcg/mem_helper: Test the right bits in psw_key_valid() Thomas Huth
2022-12-05 14:31 ` David Hildenbrand [this message]
2022-12-05 15:59 ` Nina Schoetterl-Glausch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7b530181-3cd9-24c8-541a-86502d41693e@redhat.com \
--to=david@redhat.com \
--cc=iii@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).