All of lore.kernel.org
 help / color / mirror / Atom feed
From: yamada.m@jp.panasonic.com (Masahiro Yamada)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: mm: fix size rounding-down of arm_add_memory()
Date: Fri, 28 Nov 2014 21:34:45 +0900	[thread overview]
Message-ID: <20141128213445.2EA9.AA925319@jp.panasonic.com> (raw)
In-Reply-To: <CAMuHMdVMk=6NgkQ3AuMPOTZdqx2P2U2N-QkDco+Ocd3hD-hp4A@mail.gmail.com>

Hi.


On Thu, 27 Nov 2014 12:04:47 +0100
Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> On Thu, Nov 27, 2014 at 11:50 AM, Ard Biesheuvel
> <ard.biesheuvel@linaro.org> wrote:
> >>>>> --- a/arch/arm/kernel/setup.c
> >>>>> +++ b/arch/arm/kernel/setup.c
> >>>>> @@ -641,8 +641,8 @@ int __init arm_add_memory(u64 start, u64 size)
> >>>>>        * Ensure that start/size are aligned to a page boundary.
> >>>>>        * Size is appropriately rounded down, start is rounded up.
> >>>>>        */
> >>>>> -     size -= start & ~PAGE_MASK;
> >>>>>       aligned_start = PAGE_ALIGN(start);
> >>>>> +     size -= aligned_start - start;
> >
> > Beware that if size if sufficiently small, (i.e., smaller than the
> > unaligned leading fraction @ start), this wraps around and produces a
> > bogus value.

Uh-oh, yes. I missed this.


> 
> That could have happened before, couldn't it?
> 
> Nevertheless, fixing that can be a follow-up patch?
> Unless Yamada-san wants to incorporate the fix in this patch?

We don't two patches to fix one place.

If you are willing to fix it,
please feel free to discard mine and send a new patch.


(If nobody would fix that, I am happy to contribute
for fixing this issue, of course.)



Best Regards
Masahiro Yamada

      reply	other threads:[~2014-11-28 12:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06  3:32 [PATCH] ARM: mm: fix size rounding-down of arm_add_memory() Masahiro Yamada
2014-08-01 12:37 ` Masahiro Yamada
2014-08-20 15:08   ` Geert Uytterhoeven
2014-11-27 10:36     ` Geert Uytterhoeven
2014-11-27 10:40       ` Russell King - ARM Linux
2014-11-27 10:50       ` Ard Biesheuvel
2014-11-27 11:04         ` Geert Uytterhoeven
2014-11-28 12:34           ` Masahiro Yamada [this message]

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=20141128213445.2EA9.AA925319@jp.panasonic.com \
    --to=yamada.m@jp.panasonic.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.