Merge branches 'x86/xen', 'x86/build', 'x86/microcode', 'x86/mm-debug-v2', 'x86/memor...
[sfrench/cifs-2.6.git] / mm / vmalloc.c
index 35f2938162948b02003007c31686f1b58d7af542..bba06c41fc59ed10be118f7af24ecfa71d023c33 100644 (file)
@@ -180,6 +180,13 @@ struct page *vmalloc_to_page(const void *vmalloc_addr)
        pmd_t *pmd;
        pte_t *ptep, pte;
 
+       /*
+        * XXX we might need to change this if we add VIRTUAL_BUG_ON for
+        * architectures that do not vmalloc module space
+        */
+       VIRTUAL_BUG_ON(!is_vmalloc_addr(vmalloc_addr) &&
+                       !is_module_address(addr));
+
        if (!pgd_none(*pgd)) {
                pud = pud_offset(pgd, addr);
                if (!pud_none(*pud)) {
@@ -381,16 +388,14 @@ static void __vunmap(const void *addr, int deallocate_pages)
                return;
 
        if ((PAGE_SIZE-1) & (unsigned long)addr) {
-               printk(KERN_ERR "Trying to vfree() bad address (%p)\n", addr);
-               WARN_ON(1);
+               WARN(1, KERN_ERR "Trying to vfree() bad address (%p)\n", addr);
                return;
        }
 
        area = remove_vm_area(addr);
        if (unlikely(!area)) {
-               printk(KERN_ERR "Trying to vfree() nonexistent vm area (%p)\n",
+               WARN(1, KERN_ERR "Trying to vfree() nonexistent vm area (%p)\n",
                                addr);
-               WARN_ON(1);
                return;
        }