]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
clocksource: Remove unnecessary strscpy() size argument
authorThorsten Blum <thorsten.blum@linux.dev>
Tue, 11 Mar 2025 11:06:24 +0000 (12:06 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 13 Mar 2025 10:37:44 +0000 (11:37 +0100)
The size argument of strscpy() is only required when the destination
pointer is not a fixed sized array or when the copy needs to be smaller
than the size of the fixed sized destination array.

For fixed sized destination arrays and full copies, strscpy() automatically
determines the length of the destination buffer if the size argument is
omitted.

This makes the explicit sizeof() unnecessary. Remove it.

[ tglx: Massaged change log ]

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250311110624.495718-2-thorsten.blum@linux.dev
kernel/time/clocksource.c

index 2a7802ec480cc5d0ea03d1b4666d321f196eeb56..e0eeacbe2521d70f61889658e2f1af1281dfd3b0 100644 (file)
@@ -1510,7 +1510,7 @@ static int __init boot_override_clocksource(char* str)
 {
        mutex_lock(&clocksource_mutex);
        if (str)
-               strscpy(override_name, str, sizeof(override_name));
+               strscpy(override_name, str);
        mutex_unlock(&clocksource_mutex);
        return 1;
 }