Skip to content

Commit 79f76df

Browse files
tobluxandreas-gaisler
authored andcommitted
sparc64: Replace deprecated strcpy() with strscpy() in build_path_component()
strcpy() is deprecated; use strscpy() instead. No functional changes intended. Link: KSPP#88 Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Andreas Larsson <andreas@gaisler.com> Signed-off-by: Andreas Larsson <andreas@gaisler.com>
1 parent b7b2c2f commit 79f76df

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

arch/sparc/kernel/prom_64.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,14 +361,16 @@ char * __init build_path_component(struct device_node *dp)
361361
{
362362
const char *name = of_get_property(dp, "name", NULL);
363363
char tmp_buf[64], *n;
364+
size_t n_sz;
364365

365366
tmp_buf[0] = '\0';
366367
__build_path_component(dp, tmp_buf);
367368
if (tmp_buf[0] == '\0')
368-
strcpy(tmp_buf, name);
369+
strscpy(tmp_buf, name);
369370

370-
n = prom_early_alloc(strlen(tmp_buf) + 1);
371-
strcpy(n, tmp_buf);
371+
n_sz = strlen(tmp_buf) + 1;
372+
n = prom_early_alloc(n_sz);
373+
strscpy(n, tmp_buf, n_sz);
372374

373375
return n;
374376
}

0 commit comments

Comments
 (0)