diff options
author | Wenchao Hao <haowenchao22@gmail.com> | 2020-08-12 03:31:16 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-08-12 19:57:56 +0200 |
commit | 4605f057aace9291e80bf9982cc7c8babc917f56 (patch) | |
tree | 3658fa7f2eaf07a8a48f4315ccc4ac242bf9a579 /mm/mempolicy.c | |
parent | mm: mempolicy: fix kerneldoc of numa_map_to_online_node() (diff) | |
download | linux-4605f057aace9291e80bf9982cc7c8babc917f56.tar.xz linux-4605f057aace9291e80bf9982cc7c8babc917f56.zip |
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>
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r-- | mm/mempolicy.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 92030ead2506..25b7e412c20b 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -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) |