Commit 7e7f94d1 authored by Heiko Carstens's avatar Heiko Carstens
Browse files

s390/boot: Use strspcy() instead of strcpy()



Convert all strcpy() usages to strscpy(). strcpy() is deprecated since
it performs no bounds checking on the destination buffer.

Reviewed-by: default avatarMikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent e76b8c1d
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ void setup_boot_command_line(void)
	if (has_ebcdic_char(parmarea.command_line))
		EBCASC(parmarea.command_line, COMMAND_LINE_SIZE);
	/* copy arch command line */
	strcpy(early_command_line, strim(parmarea.command_line));
	strscpy(early_command_line, strim(parmarea.command_line));

	/* append IPL PARM data to the boot command line */
	if (!is_prot_virt_guest() && ipl_block_valid)
@@ -253,7 +253,8 @@ void parse_boot_command_line(void)
	int rc;

	__kaslr_enabled = IS_ENABLED(CONFIG_RANDOMIZE_BASE);
	args = strcpy(command_line_buf, early_command_line);
	strscpy(command_line_buf, early_command_line);
	args = command_line_buf;
	while (*args) {
		args = next_arg(args, &param, &val);

+3 −2
Original line number Diff line number Diff line
@@ -29,7 +29,8 @@ static void boot_rb_add(const char *str, size_t len)
	/* store strings separated by '\0' */
	if (len + 1 > avail)
		boot_rb_off = 0;
	strcpy(boot_rb + boot_rb_off, str);
	avail = sizeof(boot_rb) - boot_rb_off - 1;
	strscpy(boot_rb + boot_rb_off, str, avail);
	boot_rb_off += len + 1;
}

@@ -161,7 +162,7 @@ static noinline char *strsym(char *buf, void *ip)
		strscpy(buf, p, MAX_SYMLEN);
		/* reserve 15 bytes for offset/len in symbol+0x1234/0x1234 */
		p = buf + strnlen(buf, MAX_SYMLEN - 15);
		strcpy(p, "+0x");
		strscpy(p, "+0x", MAX_SYMLEN - (p - buf));
		as_hex(p + 3, off, 0);
		strcat(p, "/0x");
		as_hex(p + strlen(p), len, 0);