The patch titled Subject: mm/mempolicy.c: check parameters first in kernel_get_mempolicy has been added to the -mm tree. Its filename is mm-mempolicy-check-parameters-first-in-kernel_get_mempolicy.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-mempolicy-check-parameters-first-in-kernel_get_mempolicy.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-mempolicy-check-parameters-first-in-kernel_get_mempolicy.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Wenchao Hao <haowenchao22@xxxxxxxxx> Subject: 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. Link: http://lkml.kernel.org/r/20200801090825.5597-1-haowenchao22@xxxxxxxxx Signed-off-by: Wenchao Hao <haowenchao22@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/mempolicy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/mempolicy.c~mm-mempolicy-check-parameters-first-in-kernel_get_mempolicy +++ a/mm/mempolicy.c @@ -1632,11 +1632,11 @@ static int kernel_get_mempolicy(int __us 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) _ Patches currently in -mm which might be from haowenchao22@xxxxxxxxx are mm-mempolicy-check-parameters-first-in-kernel_get_mempolicy.patch