From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: Re: [PATCH 1/3] hw/m68k/mcf5208: Avoid shifting off end of integer
Date: Mon, 2 Sep 2024 07:39:30 +1000 [thread overview]
Message-ID: <268c5d7f-9ced-4804-9c5b-97c255e48855@linaro.org> (raw)
In-Reply-To: <65291b1a-e1cd-42ea-8aad-233bd899b528@linaro.org>
On 9/2/24 07:34, Richard Henderson wrote:
>> @@ -158,7 +158,7 @@ static uint64_t m5208_sys_read(void *opaque, hwaddr addr,
>> {
>> int n;
>> for (n = 0; n < 32; n++) {
>> - if (current_machine->ram_size < (2u << n)) {
>> + if (current_machine->ram_size < (2ULL << n)) {
>> break;
>> }
>> }
>
> 31 - clz32(ram_size)
We might could do with lg2_pow2ceil() in host-utils.h, if that's clearer.
r~
next prev parent reply other threads:[~2024-09-01 21:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 17:34 [PATCH 0/3] m68k: Fix a couple of Coverity nits Peter Maydell
2024-08-30 17:34 ` [PATCH 1/3] hw/m68k/mcf5208: Avoid shifting off end of integer Peter Maydell
2024-08-30 21:59 ` Thomas Huth
2024-09-01 21:34 ` Richard Henderson
2024-09-01 21:39 ` Richard Henderson [this message]
2024-08-30 17:34 ` [PATCH 2/3] hw/m68k/mcf5208: Add URLs for datasheets Peter Maydell
2024-08-30 22:02 ` Thomas Huth
2024-08-30 17:34 ` [PATCH 3/3] hw/nubus/nubus-device: Range check 'slot' property Peter Maydell
2024-08-30 22:03 ` Thomas Huth
2024-09-01 12:13 ` Mark Cave-Ayland
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=268c5d7f-9ced-4804-9c5b-97c255e48855@linaro.org \
--to=richard.henderson@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).