Skip to content

Commit e76b8c1

Browse files
committed
s390: Simple strcpy() to strscpy() conversions
Convert all strcpy() usages to strscpy() where the conversion means just replacing strcpy() with strscpy(). strcpy() is deprecated since it performs no bounds checking on the destination buffer. Reviewed-by: Mikhail Zaslonko <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent e75003a commit e76b8c1

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

arch/s390/kernel/crash_dump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static void *nt_prpsinfo(void *ptr)
354354

355355
memset(&prpsinfo, 0, sizeof(prpsinfo));
356356
prpsinfo.pr_sname = 'R';
357-
strcpy(prpsinfo.pr_fname, "vmlinux");
357+
strscpy(prpsinfo.pr_fname, "vmlinux");
358358
return nt_init(ptr, PRPSINFO, prpsinfo);
359359
}
360360

arch/s390/kernel/processor.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,35 +268,35 @@ static int __init setup_elf_platform(void)
268268
add_device_randomness(&cpu_id, sizeof(cpu_id));
269269
switch (cpu_id.machine) {
270270
default: /* Use "z10" as default. */
271-
strcpy(elf_platform, "z10");
271+
strscpy(elf_platform, "z10");
272272
break;
273273
case 0x2817:
274274
case 0x2818:
275-
strcpy(elf_platform, "z196");
275+
strscpy(elf_platform, "z196");
276276
break;
277277
case 0x2827:
278278
case 0x2828:
279-
strcpy(elf_platform, "zEC12");
279+
strscpy(elf_platform, "zEC12");
280280
break;
281281
case 0x2964:
282282
case 0x2965:
283-
strcpy(elf_platform, "z13");
283+
strscpy(elf_platform, "z13");
284284
break;
285285
case 0x3906:
286286
case 0x3907:
287-
strcpy(elf_platform, "z14");
287+
strscpy(elf_platform, "z14");
288288
break;
289289
case 0x8561:
290290
case 0x8562:
291-
strcpy(elf_platform, "z15");
291+
strscpy(elf_platform, "z15");
292292
break;
293293
case 0x3931:
294294
case 0x3932:
295-
strcpy(elf_platform, "z16");
295+
strscpy(elf_platform, "z16");
296296
break;
297297
case 0x9175:
298298
case 0x9176:
299-
strcpy(elf_platform, "z17");
299+
strscpy(elf_platform, "z17");
300300
break;
301301
}
302302
return 0;

drivers/s390/block/dcssblk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ dcssblk_load_segment(char *name, struct segment_info **seg_info)
314314
if (*seg_info == NULL)
315315
return -ENOMEM;
316316

317-
strcpy((*seg_info)->segment_name, name);
317+
strscpy((*seg_info)->segment_name, name);
318318

319319
/* load the segment */
320320
rc = segment_load(name, SEGMENT_SHARED,
@@ -612,7 +612,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
612612
rc = -ENOMEM;
613613
goto out;
614614
}
615-
strcpy(dev_info->segment_name, local_buf);
615+
strscpy(dev_info->segment_name, local_buf);
616616
dev_info->segment_type = seg_info->segment_type;
617617
INIT_LIST_HEAD(&dev_info->seg_list);
618618
}

drivers/s390/net/ctcm_mpc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ void ctcmpc_dumpit(char *buf, int len)
179179
ctcm_pr_debug(" %s (+%s) : %s [%s]\n",
180180
addr, boff, bhex, basc);
181181
dup = 0;
182-
strcpy(duphex, bhex);
182+
strscpy(duphex, bhex);
183183
} else
184184
dup++;
185185

0 commit comments

Comments
 (0)