From: Masahiro Yamada <yamada.m@jp.panasonic.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>,
Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Daniel Thompson <daniel.thompson@linaro.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Laura Abbott <lauraa@codeaurora.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Olof Johansson <olof@lixom.net>,
Santosh Shilimkar <santosh.shilimkar@ti.com>,
Andrew Morton <akpm@linux-foundation.org>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2] ARM: mm: fix size rounding-down of arm_add_memory() function
Date: Wed, 14 Jan 2015 11:53:42 +0900 [thread overview]
Message-ID: <20150114115342.70FB.AA925319@jp.panasonic.com> (raw)
In-Reply-To: <CAKv+Gu8QSSC32VVwBzSiDL_3t_dd=2Oa+Xp5r8mtDrGBW9E0ow@mail.gmail.com>
Hello Russell King,
Could you apply this patch for arm_add_memory() fix, please ?
Thanks,
Masahiro Yamada
On Mon, 22 Dec 2014 10:09:32 +0100
Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 22 December 2014 at 04:17, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> > The current rounding of "size" is wrong:
> >
> > - If "start" is sufficiently near the next page boundary, "size"
> > is decremented by more than enough and the last page is lost.
> >
> > - If "size" is sufficiently small, it is wrapped around and gets
> > a bogus value.
> >
> > Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> > Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
>
> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
>
> > ---
> >
> > Changes in v2:
> > - Avoid wrap around of "size"
> >
> > arch/arm/kernel/setup.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> > index f9c8639..d13f185 100644
> > --- a/arch/arm/kernel/setup.c
> > +++ b/arch/arm/kernel/setup.c
> > @@ -657,10 +657,13 @@ 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 is rounded down, start is rounded up.
> > */
> > - size -= start & ~PAGE_MASK;
> > aligned_start = PAGE_ALIGN(start);
> > + if (aligned_start > start + size)
> > + size = 0;
> > + else
> > + size -= aligned_start - start;
> >
> > #ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT
> > if (aligned_start > ULONG_MAX) {
> > --
> > 1.9.1
> >
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2015-01-14 2:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-22 3:17 Masahiro Yamada
2014-12-22 9:09 ` Ard Biesheuvel
2015-01-14 2:53 ` 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=20150114115342.70FB.AA925319@jp.panasonic.com \
--to=yamada.m@jp.panasonic.com \
--cc=akpm@linux-foundation.org \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=daniel.thompson@linaro.org \
--cc=geert@linux-m68k.org \
--cc=lauraa@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=olof@lixom.net \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=santosh.shilimkar@ti.com \
--cc=will.deacon@arm.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
all inboxes | Powered by JetHome®