]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86: dell_rbu: use strscpy in image_type_write
authorThorsten Blum <thorsten.blum@linux.dev>
Fri, 10 Apr 2026 09:16:36 +0000 (11:16 +0200)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 28 Apr 2026 13:16:29 +0000 (16:16 +0300)
strcpy() has been deprecated [1] because it performs no bounds checking
on the destination buffer, which can lead to buffer overflows. While the
current code works correctly, replace strcpy() with the safer strscpy()
to follow secure coding best practices.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://patch.msgid.link/20260410091633.2822-6-thorsten.blum@linux.dev
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/dell/dell_rbu.c

index 3fa9de9aa47b809edab69ca2e8fecfaa9405d823..768b15f406d3baf2b94abd31e7c5200708144c1b 100644 (file)
@@ -562,9 +562,9 @@ static ssize_t image_type_write(struct file *filp, struct kobject *kobj,
                buffer[count] = '\0';
 
        if (strstr(buffer, "mono"))
-               strcpy(image_type, "mono");
+               strscpy(image_type, "mono");
        else if (strstr(buffer, "packet"))
-               strcpy(image_type, "packet");
+               strscpy(image_type, "packet");
        else if (strstr(buffer, "init")) {
                /*
                 * If due to the user error the driver gets in a bad