]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dio: Replace deprecated strcpy with strscpy in dio_init
authorThorsten Blum <thorsten.blum@linux.dev>
Mon, 4 May 2026 08:18:05 +0000 (10:18 +0200)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 18 May 2026 09:16:21 +0000 (11:16 +0200)
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.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://patch.msgid.link/20260504081804.3260-3-thorsten.blum@linux.dev
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
drivers/dio/dio.c

index 419b3c13d4913e50454eaac7592308a41cb4b267..4a3ddda97d7c5d4f5e0b5fba798f2a25b59be249 100644 (file)
@@ -247,7 +247,7 @@ static int __init dio_init(void)
                        dev->id = prid;
 
                dev->ipl = DIO_IPL(va);
-               strcpy(dev->name, dio_getname(dev->id));
+               strscpy(dev->name, dio_getname(dev->id));
                 printk(KERN_INFO "select code %3d: ipl %d: ID %02X", dev->scode, dev->ipl, prid);
                if (DIO_NEEDSSECID(prid))
                         printk(":%02X", secid);