]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - mm/hugetlb.c
drm/amdgpu: add VEGAM VCE firmware support
[linux.git] / mm / hugetlb.c
index a963f2034dfced0debfddd1cd369a6294d60d63e..976bbc5646fe8c6e386ddb0d42b8ba0ccb3e9777 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/bootmem.h>
 #include <linux/sysfs.h>
 #include <linux/slab.h>
+#include <linux/mmdebug.h>
 #include <linux/sched/signal.h>
 #include <linux/rmap.h>
 #include <linux/string_helpers.h>
@@ -4374,6 +4375,12 @@ int hugetlb_reserve_pages(struct inode *inode,
        struct resv_map *resv_map;
        long gbl_reserve;
 
+       /* This should never happen */
+       if (from > to) {
+               VM_WARN(1, "%s called with a negative range\n", __func__);
+               return -EINVAL;
+       }
+
        /*
         * Only apply hugepage reservation if asked. At fault time, an
         * attempt will be made for VM_NORESERVE to allocate a page