Skip to content

Commit fe01267

Browse files
tobluxandreas-gaisler
authored andcommitted
sparc: Replace deprecated strcpy() with strscpy() in handle_nextprop_quirks()
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 79f76df commit fe01267

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

arch/sparc/kernel/prom_common.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,14 @@ EXPORT_SYMBOL(of_find_in_proplist);
120120
*/
121121
static int __init handle_nextprop_quirks(char *buf, const char *name)
122122
{
123-
if (!name || strlen(name) == 0)
123+
size_t name_len;
124+
125+
name_len = name ? strlen(name) : 0;
126+
if (name_len == 0)
124127
return -1;
125128

126129
#ifdef CONFIG_SPARC32
127-
strcpy(buf, name);
130+
strscpy(buf, name, name_len + 1);
128131
#endif
129132
return 0;
130133
}

0 commit comments

Comments
 (0)