diff options
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r-- | mm/hugetlb.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index a963f2034dfc..976bbc5646fe 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/bootmem.h> | 18 | #include <linux/bootmem.h> |
19 | #include <linux/sysfs.h> | 19 | #include <linux/sysfs.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/mmdebug.h> | ||
21 | #include <linux/sched/signal.h> | 22 | #include <linux/sched/signal.h> |
22 | #include <linux/rmap.h> | 23 | #include <linux/rmap.h> |
23 | #include <linux/string_helpers.h> | 24 | #include <linux/string_helpers.h> |
@@ -4374,6 +4375,12 @@ int hugetlb_reserve_pages(struct inode *inode, | |||
4374 | struct resv_map *resv_map; | 4375 | struct resv_map *resv_map; |
4375 | long gbl_reserve; | 4376 | long gbl_reserve; |
4376 | 4377 | ||
4378 | /* This should never happen */ | ||
4379 | if (from > to) { | ||
4380 | VM_WARN(1, "%s called with a negative range\n", __func__); | ||
4381 | return -EINVAL; | ||
4382 | } | ||
4383 | |||
4377 | /* | 4384 | /* |
4378 | * Only apply hugepage reservation if asked. At fault time, an | 4385 | * Only apply hugepage reservation if asked. At fault time, an |
4379 | * attempt will be made for VM_NORESERVE to allocate a page | 4386 | * attempt will be made for VM_NORESERVE to allocate a page |