]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - mm/mmzone.c
[ARM] Double check memmap is actually valid with a memmap has unexpected holes V2
[mirror_ubuntu-zesty-kernel.git] / mm / mmzone.c
index 16ce8b955dcff121623fc14810a9f12999f7ea3d..f5b7d1760213e53db3c46e84dde56daf219ea0cd 100644 (file)
@@ -6,6 +6,7 @@
 
 
 #include <linux/stddef.h>
+#include <linux/mm.h>
 #include <linux/mmzone.h>
 #include <linux/module.h>
 
@@ -72,3 +73,17 @@ struct zoneref *next_zones_zonelist(struct zoneref *z,
        *zone = zonelist_zone(z);
        return z;
 }
+
+#ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
+int memmap_valid_within(unsigned long pfn,
+                                       struct page *page, struct zone *zone)
+{
+       if (page_to_pfn(page) != pfn)
+               return 0;
+
+       if (page_zone(page) != zone)
+               return 0;
+
+       return 1;
+}
+#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */