All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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.