* [PATCH] ARM: mm: fix size rounding-down of arm_add_memory() @ 2014-06-06 3:32 Masahiro Yamada 2014-08-01 12:37 ` Masahiro Yamada 0 siblings, 1 reply; 8+ messages in thread From: Masahiro Yamada @ 2014-06-06 3:32 UTC (permalink / raw) To: linux-arm-kernel The current rounding of "size" is wrong. size -= start & ~PAGE_MASK; should be size -= PAGE_SIZE - (start & ~PAGE_MASK); Or more simply size -= aligned_start - start; Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> --- arch/arm/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 50e198c..84508c0 100644 --- 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; #ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT if (aligned_start > ULONG_MAX) { -- 1.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] ARM: mm: fix size rounding-down of arm_add_memory() 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 0 siblings, 1 reply; 8+ messages in thread From: Masahiro Yamada @ 2014-08-01 12:37 UTC (permalink / raw) To: linux-arm-kernel Hi. Any comments for this patch? Thanks Best Regards Masahiro Yamada On Fri, 6 Jun 2014 12:32:47 +0900 Masahiro Yamada <yamada.m@jp.panasonic.com> wrote: > The current rounding of "size" is wrong. > > size -= start & ~PAGE_MASK; > > should be > > size -= PAGE_SIZE - (start & ~PAGE_MASK); > > Or more simply > > size -= aligned_start - start; > > Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> > --- > arch/arm/kernel/setup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c > index 50e198c..84508c0 100644 > --- 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; > > #ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT > if (aligned_start > ULONG_MAX) { > -- > 1.9.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] ARM: mm: fix size rounding-down of arm_add_memory() 2014-08-01 12:37 ` Masahiro Yamada @ 2014-08-20 15:08 ` Geert Uytterhoeven 2014-11-27 10:36 ` Geert Uytterhoeven 0 siblings, 1 reply; 8+ messages in thread From: Geert Uytterhoeven @ 2014-08-20 15:08 UTC (permalink / raw) To: linux-arm-kernel Hi Yamada-san, On Fri, Aug 1, 2014 at 2:37 PM, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote: > Any comments for this patch? Thanks for your patch! I had a slightly different fix for the same issue, but apparently it got stuck on the freshly installed machine that didn't have email set up yet ;-( Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> early_init_dt_add_memory_arch() has the same bug, I'll resend my (also stuck) fix for that. > Thanks > > Best Regards > Masahiro Yamada > > > > On Fri, 6 Jun 2014 12:32:47 +0900 > Masahiro Yamada <yamada.m@jp.panasonic.com> wrote: > >> The current rounding of "size" is wrong. >> >> size -= start & ~PAGE_MASK; >> >> should be >> >> size -= PAGE_SIZE - (start & ~PAGE_MASK); >> >> Or more simply >> >> size -= aligned_start - start; >> >> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> >> --- >> arch/arm/kernel/setup.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c >> index 50e198c..84508c0 100644 >> --- 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; >> >> #ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT >> if (aligned_start > ULONG_MAX) { >> -- >> 1.9.1 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] ARM: mm: fix size rounding-down of arm_add_memory() 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 0 siblings, 2 replies; 8+ messages in thread From: Geert Uytterhoeven @ 2014-11-27 10:36 UTC (permalink / raw) To: linux-arm-kernel Any chance we can get this fix applied? On Wed, Aug 20, 2014 at 5:08 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > Hi Yamada-san, > > On Fri, Aug 1, 2014 at 2:37 PM, Masahiro Yamada > <yamada.m@jp.panasonic.com> wrote: >> Any comments for this patch? > > Thanks for your patch! > > I had a slightly different fix for the same issue, but apparently it got stuck > on the freshly installed machine that didn't have email set up yet ;-( > > Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> > > early_init_dt_add_memory_arch() has the same bug, I'll resend my (also stuck) > fix for that. > >> Thanks >> >> Best Regards >> Masahiro Yamada >> >> >> >> On Fri, 6 Jun 2014 12:32:47 +0900 >> Masahiro Yamada <yamada.m@jp.panasonic.com> wrote: >> >>> The current rounding of "size" is wrong. >>> >>> size -= start & ~PAGE_MASK; >>> >>> should be >>> >>> size -= PAGE_SIZE - (start & ~PAGE_MASK); >>> >>> Or more simply >>> >>> size -= aligned_start - start; >>> >>> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> >>> --- >>> arch/arm/kernel/setup.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c >>> index 50e198c..84508c0 100644 >>> --- 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; >>> >>> #ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT >>> if (aligned_start > ULONG_MAX) { >>> -- >>> 1.9.1 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] ARM: mm: fix size rounding-down of arm_add_memory() 2014-11-27 10:36 ` Geert Uytterhoeven @ 2014-11-27 10:40 ` Russell King - ARM Linux 2014-11-27 10:50 ` Ard Biesheuvel 1 sibling, 0 replies; 8+ messages in thread From: Russell King - ARM Linux @ 2014-11-27 10:40 UTC (permalink / raw) To: linux-arm-kernel On Thu, Nov 27, 2014 at 11:36:31AM +0100, Geert Uytterhoeven wrote: > Any chance we can get this fix applied? As ever, if it ends up in the patch system, then I'll apply it, otherwise it very quickly falls off of my radar due to the shere volume of email I receive. -- FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] ARM: mm: fix size rounding-down of arm_add_memory() 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 1 sibling, 1 reply; 8+ messages in thread From: Ard Biesheuvel @ 2014-11-27 10:50 UTC (permalink / raw) To: linux-arm-kernel On 27 November 2014 at 11:36, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > Any chance we can get this fix applied? > > On Wed, Aug 20, 2014 at 5:08 PM, Geert Uytterhoeven > <geert@linux-m68k.org> wrote: >> Hi Yamada-san, >> >> On Fri, Aug 1, 2014 at 2:37 PM, Masahiro Yamada >> <yamada.m@jp.panasonic.com> wrote: >>> Any comments for this patch? >> >> Thanks for your patch! >> >> I had a slightly different fix for the same issue, but apparently it got stuck >> on the freshly installed machine that didn't have email set up yet ;-( >> >> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> >> >> early_init_dt_add_memory_arch() has the same bug, I'll resend my (also stuck) >> fix for that. >> >>> Thanks >>> >>> Best Regards >>> Masahiro Yamada >>> >>> >>> >>> On Fri, 6 Jun 2014 12:32:47 +0900 >>> Masahiro Yamada <yamada.m@jp.panasonic.com> wrote: >>> >>>> The current rounding of "size" is wrong. >>>> >>>> size -= start & ~PAGE_MASK; >>>> >>>> should be >>>> >>>> size -= PAGE_SIZE - (start & ~PAGE_MASK); >>>> >>>> Or more simply >>>> >>>> size -= aligned_start - start; >>>> >>>> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> >>>> --- >>>> arch/arm/kernel/setup.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c >>>> index 50e198c..84508c0 100644 >>>> --- 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. -- Ard. >>>> >>>> #ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT >>>> if (aligned_start > ULONG_MAX) { >>>> -- >>>> 1.9.1 > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel at lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] ARM: mm: fix size rounding-down of arm_add_memory() 2014-11-27 10:50 ` Ard Biesheuvel @ 2014-11-27 11:04 ` Geert Uytterhoeven 2014-11-28 12:34 ` Masahiro Yamada 0 siblings, 1 reply; 8+ messages in thread From: Geert Uytterhoeven @ 2014-11-27 11:04 UTC (permalink / raw) To: linux-arm-kernel 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. 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? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] ARM: mm: fix size rounding-down of arm_add_memory() 2014-11-27 11:04 ` Geert Uytterhoeven @ 2014-11-28 12:34 ` Masahiro Yamada 0 siblings, 0 replies; 8+ messages in thread From: Masahiro Yamada @ 2014-11-28 12:34 UTC (permalink / raw) To: linux-arm-kernel 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-11-28 12:34 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 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.