diff options
Diffstat (limited to 'arch/x86/mm/ioremap.c')
-rw-r--r-- | arch/x86/mm/ioremap.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index c004d94608fd..1a88d1572a77 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -116,7 +116,7 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, | |||
116 | { | 116 | { |
117 | void __iomem *addr; | 117 | void __iomem *addr; |
118 | struct vm_struct *area; | 118 | struct vm_struct *area; |
119 | unsigned long offset, last_addr; | 119 | unsigned long pfn, offset, last_addr; |
120 | pgprot_t prot; | 120 | pgprot_t prot; |
121 | 121 | ||
122 | /* Don't allow wraparound or zero size */ | 122 | /* Don't allow wraparound or zero size */ |
@@ -133,9 +133,10 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, | |||
133 | /* | 133 | /* |
134 | * Don't allow anybody to remap normal RAM that we're using.. | 134 | * Don't allow anybody to remap normal RAM that we're using.. |
135 | */ | 135 | */ |
136 | for (offset = phys_addr >> PAGE_SHIFT; offset < max_pfn_mapped && | 136 | for (pfn = phys_addr >> PAGE_SHIFT; pfn < max_pfn_mapped && |
137 | (offset << PAGE_SHIFT) < last_addr; offset++) { | 137 | (pfn << PAGE_SHIFT) < last_addr; pfn++) { |
138 | if (page_is_ram(offset)) | 138 | if (page_is_ram(pfn) && pfn_valid(pfn) && |
139 | !PageReserved(pfn_to_page(pfn))) | ||
139 | return NULL; | 140 | return NULL; |
140 | } | 141 | } |
141 | 142 | ||