aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Murzin <vladimir.murzin@arm.com>2015-04-14 18:48:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-14 19:49:06 -0400
commit7f70baeeb9e2d2b2a37a4bd3727d709547c4ae41 (patch)
treebd0dbb537180d25d31e1cd7eaf05b28e0597bd5e
parent4a20799d11f64e6b8725cacc7619b1ae1dbf9acd (diff)
memtest: use phys_addr_t for physical addresses
Since memtest might be used by other architectures pass input parameters as phys_addr_t instead of long to prevent overflow. Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com> Acked-by: Will Deacon <will.deacon@arm.com> Tested-by: Mark Rutland <mark.rutland@arm.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/memblock.h4
-rw-r--r--mm/memtest.c16
2 files changed, 10 insertions, 10 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 6724cb020f5e..9497ec7c77ea 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -366,9 +366,9 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
366#endif 366#endif
367 367
368#ifdef CONFIG_MEMTEST 368#ifdef CONFIG_MEMTEST
369extern void early_memtest(unsigned long start, unsigned long end); 369extern void early_memtest(phys_addr_t start, phys_addr_t end);
370#else 370#else
371static inline void early_memtest(unsigned long start, unsigned long end) 371static inline void early_memtest(phys_addr_t start, phys_addr_t end)
372{ 372{
373} 373}
374#endif 374#endif
diff --git a/mm/memtest.c b/mm/memtest.c
index 1e9da795767a..1997d934b13b 100644
--- a/mm/memtest.c
+++ b/mm/memtest.c
@@ -29,7 +29,7 @@ static u64 patterns[] __initdata = {
29 0x7a6c7258554e494cULL, /* yeah ;-) */ 29 0x7a6c7258554e494cULL, /* yeah ;-) */
30}; 30};
31 31
32static void __init reserve_bad_mem(u64 pattern, u64 start_bad, u64 end_bad) 32static void __init reserve_bad_mem(u64 pattern, phys_addr_t start_bad, phys_addr_t end_bad)
33{ 33{
34 printk(KERN_INFO " %016llx bad mem addr %010llx - %010llx reserved\n", 34 printk(KERN_INFO " %016llx bad mem addr %010llx - %010llx reserved\n",
35 (unsigned long long) pattern, 35 (unsigned long long) pattern,
@@ -38,11 +38,11 @@ static void __init reserve_bad_mem(u64 pattern, u64 start_bad, u64 end_bad)
38 memblock_reserve(start_bad, end_bad - start_bad); 38 memblock_reserve(start_bad, end_bad - start_bad);
39} 39}
40 40
41static void __init memtest(u64 pattern, u64 start_phys, u64 size) 41static void __init memtest(u64 pattern, phys_addr_t start_phys, phys_addr_t size)
42{ 42{
43 u64 *p, *start, *end; 43 u64 *p, *start, *end;
44 u64 start_bad, last_bad; 44 phys_addr_t start_bad, last_bad;
45 u64 start_phys_aligned; 45 phys_addr_t start_phys_aligned;
46 const size_t incr = sizeof(pattern); 46 const size_t incr = sizeof(pattern);
47 47
48 start_phys_aligned = ALIGN(start_phys, incr); 48 start_phys_aligned = ALIGN(start_phys, incr);
@@ -69,14 +69,14 @@ static void __init memtest(u64 pattern, u64 start_phys, u64 size)
69 reserve_bad_mem(pattern, start_bad, last_bad + incr); 69 reserve_bad_mem(pattern, start_bad, last_bad + incr);
70} 70}
71 71
72static void __init do_one_pass(u64 pattern, u64 start, u64 end) 72static void __init do_one_pass(u64 pattern, phys_addr_t start, phys_addr_t end)
73{ 73{
74 u64 i; 74 u64 i;
75 phys_addr_t this_start, this_end; 75 phys_addr_t this_start, this_end;
76 76
77 for_each_free_mem_range(i, NUMA_NO_NODE, &this_start, &this_end, NULL) { 77 for_each_free_mem_range(i, NUMA_NO_NODE, &this_start, &this_end, NULL) {
78 this_start = clamp_t(phys_addr_t, this_start, start, end); 78 this_start = clamp(this_start, start, end);
79 this_end = clamp_t(phys_addr_t, this_end, start, end); 79 this_end = clamp(this_end, start, end);
80 if (this_start < this_end) { 80 if (this_start < this_end) {
81 printk(KERN_INFO " %010llx - %010llx pattern %016llx\n", 81 printk(KERN_INFO " %010llx - %010llx pattern %016llx\n",
82 (unsigned long long)this_start, 82 (unsigned long long)this_start,
@@ -102,7 +102,7 @@ static int __init parse_memtest(char *arg)
102 102
103early_param("memtest", parse_memtest); 103early_param("memtest", parse_memtest);
104 104
105void __init early_memtest(unsigned long start, unsigned long end) 105void __init early_memtest(phys_addr_t start, phys_addr_t end)
106{ 106{
107 unsigned int i; 107 unsigned int i;
108 unsigned int idx = 0; 108 unsigned int idx = 0;