mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-29 15:14:18 +08:00
mm/mempolicy.c: check parameters first in kernel_get_mempolicy
Previous implementatoin calls untagged_addr() before error check, while if the error check failed and return EINVAL, the untagged_addr() call is just useless work. Signed-off-by: Wenchao Hao <haowenchao22@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Link: http://lkml.kernel.org/r/20200801090825.5597-1-haowenchao22@gmail.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
f6e92f4048
commit
4605f057aa
@ -1632,11 +1632,11 @@ static int kernel_get_mempolicy(int __user *policy,
|
||||
int pval;
|
||||
nodemask_t nodes;
|
||||
|
||||
addr = untagged_addr(addr);
|
||||
|
||||
if (nmask != NULL && maxnode < nr_node_ids)
|
||||
return -EINVAL;
|
||||
|
||||
addr = untagged_addr(addr);
|
||||
|
||||
err = do_get_mempolicy(&pval, &nodes, addr, flags);
|
||||
|
||||
if (err)
|
||||
|
Loading…
Reference in New Issue
Block a user