]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/mm/ioremap.c
IO resources, x86: ioremap sanity check to catch mapping requests exceeding the BAR...
[linux-2.6-omap-h63xx.git] / arch / x86 / mm / ioremap.c
index 6ba6f889c79da6f7c0370df17ef529cf5dd16a93..c818b45bd07d3bade0b48174b0436d39f4134fd2 100644 (file)
@@ -149,6 +149,12 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
        if (is_ISA_range(phys_addr, last_addr))
                return (__force void __iomem *)phys_to_virt(phys_addr);
 
+       /*
+        * Check if the request spans more than any BAR in the iomem resource
+        * tree.
+        */
+       WARN_ON(iomem_map_sanity_check(phys_addr, size));
+
        /*
         * Don't allow anybody to remap normal RAM that we're using..
         */
@@ -553,13 +559,11 @@ static int __init check_early_ioremap_leak(void)
 {
        if (!early_ioremap_nested)
                return 0;
-
-       printk(KERN_WARNING
+       WARN(1, KERN_WARNING
               "Debug warning: early ioremap leak of %d areas detected.\n",
-              early_ioremap_nested);
+               early_ioremap_nested);
        printk(KERN_WARNING
-              "please boot with early_ioremap_debug and report the dmesg.\n");
-       WARN_ON(1);
+               "please boot with early_ioremap_debug and report the dmesg.\n");
 
        return 1;
 }