Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea573680 authored by Jean-Philippe Brucker's avatar Jean-Philippe Brucker Committed by Will Deacon
Browse files

arm64: kexec_file: handle empty command-line



Calling strlen() on cmdline == NULL produces a kernel oops. Since having
a NULL cmdline is valid, handle this case explicitly.

Fixes: 52b2a8af ("arm64: kexec_file: load initrd and device-tree")
Signed-off-by: default avatarJean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent d23c808c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -120,10 +120,12 @@ static int create_dtb(struct kimage *image,
{
	void *buf;
	size_t buf_size;
	size_t cmdline_len;
	int ret;

	cmdline_len = cmdline ? strlen(cmdline) : 0;
	buf_size = fdt_totalsize(initial_boot_params)
			+ strlen(cmdline) + DTB_EXTRA_SPACE;
			+ cmdline_len + DTB_EXTRA_SPACE;

	for (;;) {
		buf = vmalloc(buf_size);