Skip to content

Commit a1d3a6d

Browse files
Wolfram Sangakpm00
authored andcommitted
init: 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/ Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 512cb7e commit a1d3a6d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

init/do_mounts.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ EXPORT_SYMBOL_GPL(name_to_dev_t);
296296

297297
static int __init root_dev_setup(char *line)
298298
{
299-
strlcpy(saved_root_name, line, sizeof(saved_root_name));
299+
strscpy(saved_root_name, line, sizeof(saved_root_name));
300300
return 1;
301301
}
302302

@@ -343,7 +343,7 @@ static int __init split_fs_names(char *page, size_t size, char *names)
343343
int count = 1;
344344
char *p = page;
345345

346-
strlcpy(p, root_fs_names, size);
346+
strscpy(p, root_fs_names, size);
347347
while (*p++) {
348348
if (p[-1] == ',') {
349349
p[-1] = '\0';

init/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ static void __init setup_boot_config(void)
422422
if (!data)
423423
data = xbc_get_embedded_bootconfig(&size);
424424

425-
strlcpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
425+
strscpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
426426
err = parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL,
427427
bootconfig_params);
428428

@@ -762,7 +762,7 @@ void __init parse_early_param(void)
762762
return;
763763

764764
/* All fall through to do_early_param. */
765-
strlcpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
765+
strscpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
766766
parse_early_options(tmp_cmdline);
767767
done = 1;
768768
}

0 commit comments

Comments
 (0)