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>
---
arch/x86/mm/tlb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index f5b93e01e347..ae81e5cb510e 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -1807,10 +1807,9 @@ static ssize_t tlbflush_write_file(struct file *file,
int ceiling;
len = min(count, sizeof(buf) - 1);
- if (copy_from_user(buf, user_buf, len))
+ if (copy_from_user_nul(buf, user_buf, len))
return -EFAULT;
- buf[len] = '\0';
if (kstrtoint(buf, 0, &ceiling))
return -EINVAL;
--
2.36.1