diff options
| author | Thorsten Blum <thorsten.blum@linux.dev> | 2025-09-22 23:03:55 +0200 |
|---|---|---|
| committer | Andreas Larsson <andreas@gaisler.com> | 2025-09-26 17:27:35 +0200 |
| commit | b7b2c2f7e8848299c5cc8c596c49e90b0a39a3db (patch) | |
| tree | a7a96982452c542dd0e9b3bd33c343aff235e448 /arch/sparc/kernel | |
| parent | sparc: Replace deprecated strcpy() with strscpy() in domain services driver (diff) | |
| download | linux-b7b2c2f7e8848299c5cc8c596c49e90b0a39a3db.tar.gz linux-b7b2c2f7e8848299c5cc8c596c49e90b0a39a3db.zip | |
sparc: Replace deprecated strcpy() with strscpy() in prom_32.c
strcpy() is deprecated; use strscpy() instead.
No functional changes intended.
Link: https://github.com/KSPP/linux/issues/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>
Diffstat (limited to 'arch/sparc/kernel')
| -rw-r--r-- | arch/sparc/kernel/prom_32.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index a67dd67f10c8..cd94f1e8d644 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -187,14 +187,16 @@ char * __init build_path_component(struct device_node *dp) { const char *name = of_get_property(dp, "name", NULL); char tmp_buf[64], *n; + size_t n_sz; tmp_buf[0] = '\0'; __build_path_component(dp, tmp_buf); if (tmp_buf[0] == '\0') - strcpy(tmp_buf, name); + strscpy(tmp_buf, name); - n = prom_early_alloc(strlen(tmp_buf) + 1); - strcpy(n, tmp_buf); + n_sz = strlen(tmp_buf) + 1; + n = prom_early_alloc(n_sz); + strscpy(n, tmp_buf, n_sz); return n; } @@ -204,13 +206,14 @@ extern void restore_current(void); void __init of_console_init(void) { char *msg = "OF stdout device is: %s\n"; + const size_t of_console_path_sz = 256; struct device_node *dp; unsigned long flags; const char *type; phandle node; int skip, tmp, fd; - of_console_path = prom_early_alloc(256); + of_console_path = prom_early_alloc(of_console_path_sz); switch (prom_vers) { case PROM_V0: @@ -297,7 +300,7 @@ void __init of_console_init(void) prom_printf("No stdout-path in root node.\n"); prom_halt(); } - strcpy(of_console_path, path); + strscpy(of_console_path, path, of_console_path_sz); } break; } |
