Skip to content

Commit 267ac0a

Browse files
tobluxtsbogend
authored andcommitted
MIPS: arc: Replace deprecated strcpy() with memcpy()
strcpy() is deprecated; use memcpy() instead. Use pr_debug() instead of printk(KERN_DEBUG) to silence a checkpatch warning. Link: KSPP#88 Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 19b32db commit 267ac0a

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

arch/mips/fw/arc/cmdline.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ static char __init *move_firmware_args(int argc, LONG *argv, char *cp)
4242
{
4343
char *s;
4444
int actr, i;
45+
size_t len;
4546

4647
actr = 1; /* Always ignore argv[0] */
4748

4849
while (actr < argc) {
49-
for(i = 0; i < ARRAY_SIZE(used_arc); i++) {
50-
int len = strlen(used_arc[i][0]);
50+
for (i = 0; i < ARRAY_SIZE(used_arc); i++) {
51+
len = strlen(used_arc[i][0]);
5152

5253
if (!strncmp(prom_argv(actr), used_arc[i][0], len)) {
5354
/* Ok, we want it. First append the replacement... */
@@ -57,8 +58,9 @@ static char __init *move_firmware_args(int argc, LONG *argv, char *cp)
5758
s = strchr(prom_argv(actr), '=');
5859
if (s) {
5960
s++;
60-
strcpy(cp, s);
61-
cp += strlen(s);
61+
len = strlen(s);
62+
memcpy(cp, s, len + 1);
63+
cp += len;
6264
}
6365
*cp++ = ' ';
6466
break;
@@ -74,6 +76,7 @@ void __init prom_init_cmdline(int argc, LONG *argv)
7476
{
7577
char *cp;
7678
int actr, i;
79+
size_t len;
7780

7881
actr = 1; /* Always ignore argv[0] */
7982

@@ -86,14 +89,15 @@ void __init prom_init_cmdline(int argc, LONG *argv)
8689

8790
while (actr < argc) {
8891
for (i = 0; i < ARRAY_SIZE(ignored); i++) {
89-
int len = strlen(ignored[i]);
90-
92+
len = strlen(ignored[i]);
9193
if (!strncmp(prom_argv(actr), ignored[i], len))
9294
goto pic_cont;
9395
}
96+
9497
/* Ok, we want it. */
95-
strcpy(cp, prom_argv(actr));
96-
cp += strlen(prom_argv(actr));
98+
len = strlen(prom_argv(actr));
99+
memcpy(cp, prom_argv(actr), len + 1);
100+
cp += len;
97101
*cp++ = ' ';
98102

99103
pic_cont:
@@ -105,6 +109,6 @@ void __init prom_init_cmdline(int argc, LONG *argv)
105109
*cp = '\0';
106110

107111
#ifdef DEBUG_CMDLINE
108-
printk(KERN_DEBUG "prom cmdline: %s\n", arcs_cmdline);
112+
pr_debug("prom cmdline: %s\n", arcs_cmdline);
109113
#endif
110114
}

0 commit comments

Comments
 (0)