From: Fushuai Wang <wangfushuai@baidu.com>
Use copy_from_user_nul() instead of copy_from_user() to simplify
the code.
No functional change.
Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
---
kernel/user_namespace.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 03cb63883d04..881a05a3502c 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -1239,9 +1239,8 @@ ssize_t proc_setgroups_write(struct file *file, const char __user *buf,
/* What was written? */
ret = -EFAULT;
- if (copy_from_user(kbuf, buf, count))
+ if (copy_from_user_nul(kbuf, buf, count))
goto out;
- kbuf[count] = '\0';
pos = kbuf;
/* What is being requested? */
--
2.36.1