From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>,
qemu-devel@nongnu.org
Cc: arikalo@wavecomp.com, peter.maydell@linaro.org,
amarkovic@wavecomp.com, aurelien@aurel32.net
Subject: Re: [Qemu-devel] [PATCH 1/7] hw/misc: mips_itu: Fix 32/64 bit issue in a line involving shift operator
Date: Mon, 18 Feb 2019 22:43:05 +0100 [thread overview]
Message-ID: <9e3cf8fe-1225-5c4b-0679-db99f5471333@redhat.com> (raw)
In-Reply-To: <1550503897-31141-2-git-send-email-aleksandar.markovic@rt-rk.com>
On 2/18/19 4:31 PM, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
>
> Fix 32/64 bit issue in a line involving shift operator. "1 << ..."
> calculation of size is done as a 32-bit signed integer which may
> then be unintentionally sign-extended into the 64-bit result. The
> problem was discovered by Coverity (CID 1398648). Using "1ULL"
> instead of "1" on the LHS of the shift fixes this problem.
>
> Reproted-by: Peter Maydell <peter.maydell@linaro.org>
Reported-by
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/misc/mips_itu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c
> index 1257d8f..3afdbe6 100644
> --- a/hw/misc/mips_itu.c
> +++ b/hw/misc/mips_itu.c
> @@ -94,7 +94,7 @@ void itc_reconfigure(MIPSITUState *tag)
>
> if (tag->saar_present) {
> address = ((*(uint64_t *) tag->saar) & 0xFFFFFFFFE000ULL) << 4;
> - size = 1 << ((*(uint64_t *) tag->saar >> 1) & 0x1f);
> + size = 1ULL << ((*(uint64_t *) tag->saar >> 1) & 0x1f);
> is_enabled = *(uint64_t *) tag->saar & 1;
> }
>
>
next prev parent reply other threads:[~2019-02-18 21:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-18 15:31 [Qemu-devel] [PATCH 0/7] Misc target/mips fixes and improvements Aleksandar Markovic
2019-02-18 15:31 ` [Qemu-devel] [PATCH 1/7] hw/misc: mips_itu: Fix 32/64 bit issue in a line involving shift operator Aleksandar Markovic
2019-02-18 21:43 ` Philippe Mathieu-Daudé [this message]
2019-02-18 15:31 ` [Qemu-devel] [PATCH 2/7] tests/tcg: target/mips: Correct path to headers in some test source files Aleksandar Markovic
2019-02-19 13:37 ` Aleksandar Rikalo
2019-02-18 15:31 ` [Qemu-devel] [PATCH 3/7] tests/tcg: target/mips: Change directory name 'bit-counting' to 'bit-count' Aleksandar Markovic
2019-02-18 21:44 ` Philippe Mathieu-Daudé
2019-02-18 15:31 ` [Qemu-devel] [PATCH 4/7] tests/tcg: target/mips: Add wrappers for MSA integer compare instructions Aleksandar Markovic
2019-02-19 14:35 ` Aleksandar Rikalo
2019-02-18 15:31 ` [Qemu-devel] [PATCH 5/7] tests/tcg: target/mips: Add tests " Aleksandar Markovic
2019-02-18 15:31 ` [Qemu-devel] [PATCH 6/7] disas: nanoMIPS: Correct comments to handlers of some DSP instructions Aleksandar Markovic
2019-02-18 15:31 ` [Qemu-devel] [PATCH 7/7] disas: nanoMIPS: Fix a function misnomer Aleksandar Markovic
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=9e3cf8fe-1225-5c4b-0679-db99f5471333@redhat.com \
--to=philmd@redhat.com \
--cc=aleksandar.markovic@rt-rk.com \
--cc=amarkovic@wavecomp.com \
--cc=arikalo@wavecomp.com \
--cc=aurelien@aurel32.net \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).