ARM: Fix bank_pfn_end macro overflow
bank_pfn_end macro overflows when physical memory space
configuration ends at 0xFFFFFFFF.
The macro adds start and size together before converting
to a page frame number. Change the macro to convert start
and size first and then add them together.
Change-Id: If091fd860e6cc94f2221164bd79bf34415819e66
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index 7ef3a30..7dac1d4 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -211,7 +211,8 @@
for (iter = 0; iter < (mi)->nr_banks; iter++)
#define bank_pfn_start(bank) __phys_to_pfn((bank)->start)
-#define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size)
+#define bank_pfn_end(bank) (__phys_to_pfn((bank)->start) + \
+ __phys_to_pfn((bank)->size))
#define bank_pfn_size(bank) ((bank)->size >> PAGE_SHIFT)
#define bank_phys_start(bank) (bank)->start
#define bank_phys_end(bank) ((bank)->start + (bank)->size)