From: Fushuai Wang <[email protected]>

Use copy_from_user_nul() instead of copy_from_user() to simplify
the code.

No functional change.

Signed-off-by: Fushuai Wang <[email protected]>
---
 kernel/time/test_udelay.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/time/test_udelay.c b/kernel/time/test_udelay.c
index 783f2297111b..08ff8fd43471 100644
--- a/kernel/time/test_udelay.c
+++ b/kernel/time/test_udelay.c
@@ -107,9 +107,8 @@ static ssize_t udelay_test_write(struct file *file, const 
char __user *buf,
        if (count >= sizeof(lbuf))
                return -EINVAL;
 
-       if (copy_from_user(lbuf, buf, count))
+       if (copy_from_user_nul(lbuf, buf, count))
                return -EFAULT;
-       lbuf[count] = '\0';
 
        ret = sscanf(lbuf, "%d %d", &usecs, &iters);
        if (ret < 1)
-- 
2.36.1


Reply via email to