diff options
-rw-r--r-- | arch/x86/mm/ioremap.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 868bbde74698..17f518839028 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -35,6 +35,18 @@ unsigned long __phys_addr(unsigned long x) | |||
35 | } | 35 | } |
36 | EXPORT_SYMBOL(__phys_addr); | 36 | EXPORT_SYMBOL(__phys_addr); |
37 | 37 | ||
38 | static inline int phys_addr_valid(unsigned long addr) | ||
39 | { | ||
40 | return addr < (1UL << boot_cpu_data.x86_phys_bits); | ||
41 | } | ||
42 | |||
43 | #else | ||
44 | |||
45 | static inline int phys_addr_valid(unsigned long addr) | ||
46 | { | ||
47 | return 1; | ||
48 | } | ||
49 | |||
38 | #endif | 50 | #endif |
39 | 51 | ||
40 | int page_is_ram(unsigned long pagenr) | 52 | int page_is_ram(unsigned long pagenr) |
@@ -118,6 +130,13 @@ static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size, | |||
118 | if (!size || last_addr < phys_addr) | 130 | if (!size || last_addr < phys_addr) |
119 | return NULL; | 131 | return NULL; |
120 | 132 | ||
133 | if (!phys_addr_valid(phys_addr)) { | ||
134 | printk(KERN_WARNING "ioremap: invalid physical address %lx\n", | ||
135 | phys_addr); | ||
136 | WARN_ON_ONCE(1); | ||
137 | return NULL; | ||
138 | } | ||
139 | |||
121 | /* | 140 | /* |
122 | * Don't remap the low PCI/ISA area, it's always mapped.. | 141 | * Don't remap the low PCI/ISA area, it's always mapped.. |
123 | */ | 142 | */ |