Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: gadget: functionfs: Use safer strscpy() instead of strcpy()

Use a safer function strscpy() instead of strcpy() for copying to
arrays.

Only idiomatic code replacement, and no functional changes.

Signed-off-by: Ai Chao <aichao@kylinos.cn>
Link: https://patch.msgid.link/20260310094434.3639602-4-aichao@kylinos.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ai Chao and committed by
Greg Kroah-Hartman
224fb866 786bf7ef

+4 -4
+3 -3
drivers/usb/gadget/function/f_midi2.c
··· 1541 1541 return err; 1542 1542 midi2->card = card; 1543 1543 1544 - strcpy(card->driver, "f_midi2"); 1545 - strcpy(card->shortname, "MIDI 2.0 Gadget"); 1546 - strcpy(card->longname, "MIDI 2.0 Gadget"); 1544 + strscpy(card->driver, "f_midi2"); 1545 + strscpy(card->shortname, "MIDI 2.0 Gadget"); 1546 + strscpy(card->longname, "MIDI 2.0 Gadget"); 1547 1547 1548 1548 id = 0; 1549 1549 for (i = 0; i < midi2->num_eps; i++) {
+1 -1
drivers/usb/gadget/function/u_serial.c
··· 1086 1086 if (!cons) 1087 1087 return -ENOMEM; 1088 1088 1089 - strcpy(cons->console.name, "ttyGS"); 1089 + strscpy(cons->console.name, "ttyGS"); 1090 1090 cons->console.write = gs_console_write; 1091 1091 cons->console.device = gs_console_device; 1092 1092 cons->console.flags = CON_PRINTBUFFER;