]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - mm/hugetlb.c
afs: Fix VNOVOL handling in address rotation
[mirror_ubuntu-bionic-kernel.git] / mm / hugetlb.c
index 9a334f5fb730873190a57648bc0f040f91ac0ed6..d01912be98da683f0f781c4d1d297e880d140a0a 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>
@@ -4354,6 +4355,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