浏览代码

[PATCH] Fix units in mbind check

maxnode is a bit index and can't be directly compared against a byte length
like PAGE_SIZE

Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Andi Kleen 19 年之前
父节点
当前提交
a9c930bac1
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      mm/mempolicy.c

+ 1 - 1
mm/mempolicy.c

@@ -808,7 +808,7 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask,
 	nodes_clear(*nodes);
 	nodes_clear(*nodes);
 	if (maxnode == 0 || !nmask)
 	if (maxnode == 0 || !nmask)
 		return 0;
 		return 0;
-	if (maxnode > PAGE_SIZE)
+	if (maxnode > PAGE_SIZE*BITS_PER_BYTE)
 		return -EINVAL;
 		return -EINVAL;
 
 
 	nlongs = BITS_TO_LONGS(maxnode);
 	nlongs = BITS_TO_LONGS(maxnode);