[PATCH linux-next] clocksource: Use strscpy() instead of strlcpy()
From: cuijinpeng666
Date: Thu Oct 20 2022 - 05:13:22 EST
From: Jinpeng Cui <cui.jinpeng2@xxxxxxxxxx>
The implementation of strscpy() is more robust and safer.
Reported-by: Zeal Robot <zaelci@xxxxxxxxxx>
Signed-off-by: Jinpeng Cui <cui.jinpeng2@xxxxxxxxxx>
---
kernel/time/clocksource.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index dcaf38c06216..a3e7edfbb3c2 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -1461,7 +1461,7 @@ static int __init boot_override_clocksource(char* str)
{
mutex_lock(&clocksource_mutex);
if (str)
- strlcpy(override_name, str, sizeof(override_name));
+ strscpy(override_name, str, sizeof(override_name));
mutex_unlock(&clocksource_mutex);
return 1;
}
--
2.25.1