From: Niek Linnenbank <nieklinnenbank@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm <qemu-arm@nongnu.org>, QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH 2/2] hw/misc/allwinner-h3-dramc: enforce 64-bit multiply when calculating row mirror address
Date: Mon, 23 Mar 2020 20:27:48 +0100 [thread overview]
Message-ID: <CAPan3WrOTm2pS+9y4TSUf+z5kvkCemsnP0h-Ejm=06Fr1iyKBw@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA-dr4_tTevqJmjEy1_W5Thv1c+8ETf=-R2jTeBp-1HmOw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1931 bytes --]
Hi Peter,
On Sun, Mar 22, 2020 at 10:18 PM Peter Maydell <peter.maydell@linaro.org>
wrote:
> On Sun, 22 Mar 2020 at 20:54, Niek Linnenbank <nieklinnenbank@gmail.com>
> wrote:
> >
> > The allwinner_h3_dramc_map_rows function simulates row addressing
> behavior
> > when bootloader software attempts to detect the amount of available
> SDRAM.
> >
> > Currently the line that calculates the 64-bit address of the mirrored row
> > uses a signed 32-bit multiply operation that in theory could result in
> the
> > upper 32-bit be all 1s. This commit ensures that the row mirror address
> > is calculated using only 64-bit operations.
> >
> > Reported-by: Peter Maydell <peter.maydell@linaro.org>
> > Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com>
> > ---
> > hw/misc/allwinner-h3-dramc.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/hw/misc/allwinner-h3-dramc.c b/hw/misc/allwinner-h3-dramc.c
> > index 2b5260260e..f9f05b5384 100644
> > --- a/hw/misc/allwinner-h3-dramc.c
> > +++ b/hw/misc/allwinner-h3-dramc.c
> > @@ -85,8 +85,8 @@ static void
> allwinner_h3_dramc_map_rows(AwH3DramCtlState *s, uint8_t row_bits,
> >
> > } else if (row_bits_actual) {
> > /* Row bits not matching ram_size, install the rows mirror */
> > - hwaddr row_mirror = s->ram_addr + ((1 << (row_bits_actual +
> > - bank_bits)) *
> page_size);
> > + hwaddr row_mirror = s->ram_addr + ((1UL << (row_bits_actual +
> > + bank_bits)) *
> page_size);
>
> This needs to be a "ULL" suffix... (I just sent a different email
> with the rationale).
>
Ah ofcourse, it should be ULL indeed. And I can't think of any reason why I
made this mistake.
I simply overlooked it, thanks. I'm resending this patch with the proper
ULL suffix.
Regards,
Niek
>
> thanks
> -- PMM
>
--
Niek Linnenbank
[-- Attachment #2: Type: text/html, Size: 3038 bytes --]
next prev parent reply other threads:[~2020-03-23 19:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-22 20:54 [PATCH 1/2] hw/arm/orangepi: check for potential NULL pointer when calling blk_is_available Niek Linnenbank
2020-03-22 20:54 ` [PATCH 2/2] hw/misc/allwinner-h3-dramc: enforce 64-bit multiply when calculating row mirror address Niek Linnenbank
2020-03-22 21:18 ` Peter Maydell
2020-03-23 19:27 ` Niek Linnenbank [this message]
2020-03-26 20:59 ` [PATCH 1/2] hw/arm/orangepi: check for potential NULL pointer when calling blk_is_available Peter Maydell
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='CAPan3WrOTm2pS+9y4TSUf+z5kvkCemsnP0h-Ejm=06Fr1iyKBw@mail.gmail.com' \
--to=nieklinnenbank@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.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).