diff options
-rw-r--r-- | include/linux/gfp.h | 6 | ||||
-rw-r--r-- | mm/page_alloc.c | 3 |
2 files changed, 3 insertions, 6 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 549ec5583103..c2d3fe03b5d2 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -185,9 +185,6 @@ __alloc_pages(gfp_t gfp_mask, unsigned int order, | |||
185 | static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, | 185 | static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, |
186 | unsigned int order) | 186 | unsigned int order) |
187 | { | 187 | { |
188 | if (unlikely(order >= MAX_ORDER)) | ||
189 | return NULL; | ||
190 | |||
191 | /* Unknown node is current node */ | 188 | /* Unknown node is current node */ |
192 | if (nid < 0) | 189 | if (nid < 0) |
193 | nid = numa_node_id(); | 190 | nid = numa_node_id(); |
@@ -201,9 +198,6 @@ extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order); | |||
201 | static inline struct page * | 198 | static inline struct page * |
202 | alloc_pages(gfp_t gfp_mask, unsigned int order) | 199 | alloc_pages(gfp_t gfp_mask, unsigned int order) |
203 | { | 200 | { |
204 | if (unlikely(order >= MAX_ORDER)) | ||
205 | return NULL; | ||
206 | |||
207 | return alloc_pages_current(gfp_mask, order); | 201 | return alloc_pages_current(gfp_mask, order); |
208 | } | 202 | } |
209 | extern struct page *alloc_page_vma(gfp_t gfp_mask, | 203 | extern struct page *alloc_page_vma(gfp_t gfp_mask, |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d58df9031503..bfbd95c0610f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1401,6 +1401,9 @@ get_page_from_freelist(gfp_t gfp_mask, nodemask_t *nodemask, unsigned int order, | |||
1401 | 1401 | ||
1402 | classzone_idx = zone_idx(preferred_zone); | 1402 | classzone_idx = zone_idx(preferred_zone); |
1403 | 1403 | ||
1404 | if (WARN_ON_ONCE(order >= MAX_ORDER)) | ||
1405 | return NULL; | ||
1406 | |||
1404 | zonelist_scan: | 1407 | zonelist_scan: |
1405 | /* | 1408 | /* |
1406 | * Scan zonelist, looking for a zone with enough free. | 1409 | * Scan zonelist, looking for a zone with enough free. |