[PATCH v2 5/6] time: Use copy_from_user_nul() instead of copy_from_user()

From: Fushuai Wang

Date: Mon Jan 12 2026 - 02:32:13 EST


From: Fushuai Wang <wangfushuai@xxxxxxxxx>

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

No functional change.

Signed-off-by: Fushuai Wang <wangfushuai@xxxxxxxxx>
---
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