summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mm/mempolicy.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 72f402cc9c9a..6e870ba707c7 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -524,6 +524,8 @@ static int get_nodes(nodemask_t *nodes, unsigned long __user *nmask,
nodes_clear(*nodes);
if (maxnode == 0 || !nmask)
return 0;
+ if (maxnode > PAGE_SIZE*BITS_PER_BYTE)
+ return -EINVAL;
nlongs = BITS_TO_LONGS(maxnode);
if ((maxnode % BITS_PER_LONG) == 0)