diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2008-09-25 21:43:34 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-26 03:42:20 -0400 |
commit | 379daf6290814e41f14880094b7b773640df2461 (patch) | |
tree | e9b016fd4b8dcb0e4fbe39af75db84f313b6fd75 /arch/x86/mm | |
parent | 9a22b6e76ba75fa0f3963cdec7829156d00a7173 (diff) |
IO resources, x86: ioremap sanity check to catch mapping requests exceeding the BAR sizes
Go through the iomem resource tree to check if any of the ioremap()
requests span more than any slot in the iomem resource tree and do
a WARN_ON() if we hit this check.
This will raise a red-flag, if some driver is mapping more than what
is needed. And hopefully identify possible corruptions much earlier.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/ioremap.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index d4b6e6a29ae3..c818b45bd07d 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -150,6 +150,12 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, | |||
150 | return (__force void __iomem *)phys_to_virt(phys_addr); | 150 | return (__force void __iomem *)phys_to_virt(phys_addr); |
151 | 151 | ||
152 | /* | 152 | /* |
153 | * Check if the request spans more than any BAR in the iomem resource | ||
154 | * tree. | ||
155 | */ | ||
156 | WARN_ON(iomem_map_sanity_check(phys_addr, size)); | ||
157 | |||
158 | /* | ||
153 | * Don't allow anybody to remap normal RAM that we're using.. | 159 | * Don't allow anybody to remap normal RAM that we're using.. |
154 | */ | 160 | */ |
155 | for (pfn = phys_addr >> PAGE_SHIFT; | 161 | for (pfn = phys_addr >> PAGE_SHIFT; |