lkml.org 
[lkml]   [2020]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mm, mempolicy: Check parameters first in kernel_get_mempolicy
Date
Previous implement called untagged_addr before error check, while
if the error check failed and return EINVAL, the untagged_addr is
just useless work.

Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
---
mm/mempolicy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 381320671677..dac0cd0df3e1 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1632,11 +1632,11 @@ static int kernel_get_mempolicy(int __user *policy,
int uninitialized_var(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)
--
2.25.1
\
 
 \ /
  Last update: 2020-08-01 11:10    [W:0.034 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site