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

MIPS: move from strlcpy with unused retval to strscpy

Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Wolfram Sang and committed by
Thomas Bogendoerfer
877336c1 edeed424

+5 -5
+3 -3
arch/mips/kernel/prom.c
··· 26 26 if (name == NULL) 27 27 return; 28 28 29 - strlcpy(mips_machine_name, name, sizeof(mips_machine_name)); 29 + strscpy(mips_machine_name, name, sizeof(mips_machine_name)); 30 30 pr_info("MIPS: machine is %s\n", mips_get_machine_name()); 31 31 } 32 32 ··· 52 52 if (!of_have_populated_dt()) 53 53 panic("device tree not present"); 54 54 55 - strlcpy(of_ids[0].compatible, bus0, sizeof(of_ids[0].compatible)); 55 + strscpy(of_ids[0].compatible, bus0, sizeof(of_ids[0].compatible)); 56 56 if (bus1) { 57 - strlcpy(of_ids[1].compatible, bus1, 57 + strscpy(of_ids[1].compatible, bus1, 58 58 sizeof(of_ids[1].compatible)); 59 59 } 60 60
+1 -1
arch/mips/kernel/relocate.c
··· 340 340 early_init_dt_scan(fdt); 341 341 if (boot_command_line[0]) { 342 342 /* Boot command line was passed in device tree */ 343 - strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); 343 + strscpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); 344 344 } 345 345 #endif /* CONFIG_USE_OF */ 346 346
+1 -1
arch/mips/pic32/pic32mzda/init.c
··· 44 44 pr_info(" builtin_cmdline : %s\n", CONFIG_CMDLINE); 45 45 #endif 46 46 if (dtb != __dtb_start) 47 - strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); 47 + strscpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); 48 48 49 49 #ifdef CONFIG_EARLY_PRINTK 50 50 fw_init_early_console(-1);