ARM: mm: fix size rounding-down of arm_add_memory()
PATCH 1/1 ARM: mm: fix size rounding-down of arm_add_memory()
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;
--- arch/arm/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/setup.c +1 -1
@@ -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 ) {
Signature · 1 line
1.9.1
PATCH 1/1 ARM: mm: fix size rounding-down of arm_add_memory()
Hi.
Any comments for this patch?
Thanks
Best Regards
Masahiro Yamada
Quoted 33 lines · On Fri, 6 Jun 2014 12:32:47 +0900 Masahiro Yamada <[email protected]>…
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 <[email protected]>--- arch/arm/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/kernel/setup.c +1
-1@@ -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 ) {Signature · 1 line
1.9.1
PATCH 1/1 ARM: mm: fix size rounding-down of arm_add_memory()
Hi Yamada-san,
Quoted 1 line · Masahiro Yamada
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 ;-(
early_init_dt_add_memory_arch() has the same bug, I'll resend my (also stuck) fix for that.
Quoted 39 lines
Thanks
Best Regards
Masahiro YamadaQuoted 29 lines · On Fri, 6 Jun 2014 12:32:47 +0900 Masahiro Yamada <[email protected]>…
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 <[email protected]>--- arch/arm/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/kernel/setup.c +1
-1@@ -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;
Quoted 4 lines
Quoted 4 lines
arch/arm/kernel/setup.c +0
-1#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
PATCH 1/1 ARM: mm: fix size rounding-down of arm_add_memory()
Any chance we can get this fix applied?
Quoted 55 lines · Geert Uytterhoeven
Hi Yamada-san,
Quoted 1 line · Masahiro Yamada
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 ;-(
early_init_dt_add_memory_arch()has the same bug, I'll resend my (also stuck) fix for that.Quoted 39 lines
Thanks
Best Regards
Masahiro YamadaQuoted 29 lines · On Fri, 6 Jun 2014 12:32:47 +0900 Masahiro Yamada <[email protected]>…
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 <[email protected]>--- arch/arm/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/kernel/setup.c +1
-1@@ -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;
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/kernel/setup.c +0
-1#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
PATCH 1/1 ARM: mm: fix size rounding-down of arm_add_memory()
Quoted 1 line · Geert Uytterhoeven
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.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net.
PATCH 1/1 ARM: mm: fix size rounding-down of arm_add_memory()
In reply to Geert UytterhoevenQuoted 47 lines · Geert Uytterhoeven
Any chance we can get this fix applied?
Quoted 43 lines · Geert Uytterhoeven
Hi Yamada-san,
Quoted 1 line · Masahiro Yamada
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 ;-(
early_init_dt_add_memory_arch()has the same bug, I'll resend my (also stuck) fix for that.Quoted 27 lines
Thanks
Best Regards
Masahiro YamadaQuoted 17 lines · On Fri, 6 Jun 2014 12:32:47 +0900 Masahiro Yamada <[email protected]>…
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 <[email protected]>--- arch/arm/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
arch/arm/kernel/setup.c int __init arm_add_memory(u64 start, u64 size) · line 645
Quoted 11 lines
arch/arm/kernel/setup.c +1
-1@@ -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.
Signature · 1 line
Ard.
Quoted 21 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
arch/arm/kernel/setup.c +0
-1#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.orgIn 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
PATCH 1/1 ARM: mm: fix size rounding-down of arm_add_memory()
Quoted 5 lines · Ard Biesheuvel
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
arch/arm/kernel/setup.c +0
-0@@ -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.
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/kernel/setup.c int __init arm_add_memory(u64 start, u64 size) · line 645
Quoted 4 lines
arch/arm/kernel/setup.c +1
-1*/ - 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
PATCH 1/1 ARM: mm: fix size rounding-down of arm_add_memory()
Hi.
Quoted 15 lines · On Thu, 27 Nov 2014 12:04:47 +0100 Geert Uytterhoeven <[email protected]>…
Quoted 5 lines · Ard Biesheuvel
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
arch/arm/kernel/setup.c +0
-0@@ -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. Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/kernel/setup.c int __init arm_add_memory(u64 start, u64 size) · line 645
Quoted 4 lines
arch/arm/kernel/setup.c +1
-1*/ - 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.
Quoted 5 lines
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