From: Vladimir Murzin <vladimir.murzin@arm.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-arch@vger.kernel.org, x86@kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
akpm@linux-foundation.org, lauraa@codeaurora.org,
catalin.marinas@arm.com, will.deacon@arm.com,
linux@arm.linux.org.uk, arnd@arndb.de, mark.rutland@arm.com,
ard.biesheuvel@linaro.org
Subject: [RFC PATCH 2/4] memtest: use phys_addr_t for physical addresses
Date: Mon, 2 Mar 2015 14:55:43 +0000 [thread overview]
Message-ID: <1425308145-20769-3-git-send-email-vladimir.murzin@arm.com> (raw)
In-Reply-To: <1425308145-20769-1-git-send-email-vladimir.murzin@arm.com>
Since memtest might be used by other architectures pass input parameters
as phys_addr_t instead of long to prevent overflow.
---
include/linux/memblock.h | 4 ++--
mm/memtest.c | 16 ++++++++--------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 6724cb0..9497ec7 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
#endif
#ifdef CONFIG_MEMTEST
-extern void early_memtest(unsigned long start, unsigned long end);
+extern void early_memtest(phys_addr_t start, phys_addr_t end);
#else
-static inline void early_memtest(unsigned long start, unsigned long end)
+static inline void early_memtest(phys_addr_t start, phys_addr_t end)
{
}
#endif
diff --git a/mm/memtest.c b/mm/memtest.c
index 1e9da79..1997d93 100644
--- a/mm/memtest.c
+++ b/mm/memtest.c
@@ -29,7 +29,7 @@ static u64 patterns[] __initdata = {
0x7a6c7258554e494cULL, /* yeah ;-) */
};
-static void __init reserve_bad_mem(u64 pattern, u64 start_bad, u64 end_bad)
+static void __init reserve_bad_mem(u64 pattern, phys_addr_t start_bad, phys_addr_t end_bad)
{
printk(KERN_INFO " %016llx bad mem addr %010llx - %010llx reserved\n",
(unsigned long long) pattern,
@@ -38,11 +38,11 @@ static void __init reserve_bad_mem(u64 pattern, u64 start_bad, u64 end_bad)
memblock_reserve(start_bad, end_bad - start_bad);
}
-static void __init memtest(u64 pattern, u64 start_phys, u64 size)
+static void __init memtest(u64 pattern, phys_addr_t start_phys, phys_addr_t size)
{
u64 *p, *start, *end;
- u64 start_bad, last_bad;
- u64 start_phys_aligned;
+ phys_addr_t start_bad, last_bad;
+ phys_addr_t start_phys_aligned;
const size_t incr = sizeof(pattern);
start_phys_aligned = ALIGN(start_phys, incr);
@@ -69,14 +69,14 @@ static void __init memtest(u64 pattern, u64 start_phys, u64 size)
reserve_bad_mem(pattern, start_bad, last_bad + incr);
}
-static void __init do_one_pass(u64 pattern, u64 start, u64 end)
+static void __init do_one_pass(u64 pattern, phys_addr_t start, phys_addr_t end)
{
u64 i;
phys_addr_t this_start, this_end;
for_each_free_mem_range(i, NUMA_NO_NODE, &this_start, &this_end, NULL) {
- this_start = clamp_t(phys_addr_t, this_start, start, end);
- this_end = clamp_t(phys_addr_t, this_end, start, end);
+ this_start = clamp(this_start, start, end);
+ this_end = clamp(this_end, start, end);
if (this_start < this_end) {
printk(KERN_INFO " %010llx - %010llx pattern %016llx\n",
(unsigned long long)this_start,
@@ -102,7 +102,7 @@ static int __init parse_memtest(char *arg)
early_param("memtest", parse_memtest);
-void __init early_memtest(unsigned long start, unsigned long end)
+void __init early_memtest(phys_addr_t start, phys_addr_t end)
{
unsigned int i;
unsigned int idx = 0;
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-03-02 14:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-02 14:55 [RFC PATCH 0/4] make memtest a generic kernel feature Vladimir Murzin
2015-03-02 14:55 ` [RFC PATCH 1/4] mm: move memtest under /mm Vladimir Murzin
2015-03-03 1:52 ` Randy Dunlap
2015-03-03 9:22 ` Vladimir Murzin
2015-03-03 17:46 ` Randy Dunlap
2015-03-02 14:55 ` Vladimir Murzin [this message]
2015-03-02 14:55 ` [RFC PATCH 3/4] arm64: add support for memtest Vladimir Murzin
2015-03-02 18:56 ` Will Deacon
2015-03-03 9:26 ` Vladimir Murzin
2015-03-03 14:14 ` Catalin Marinas
2015-03-02 14:55 ` [RFC PATCH 4/4] arm: " Vladimir Murzin
2015-03-02 15:14 ` [RFC PATCH 0/4] make memtest a generic kernel feature Baruch Siach
2015-03-03 9:28 ` Vladimir Murzin
2015-03-03 16:37 ` Mark Rutland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425308145-20769-3-git-send-email-vladimir.murzin@arm.com \
--to=vladimir.murzin@arm.com \
--cc=akpm@linux-foundation.org \
--cc=ard.biesheuvel@linaro.org \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=hpa@zytor.com \
--cc=lauraa@codeaurora.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox