Commit 364f2c39 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Miguel Ojeda
Browse files

auxdisplay: linedisp: Use kmemdup_nul() helper



Use the existing kmemdup_nul() helper instead of open-coding the same
operation.

Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
parent 7e76aece
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -91,13 +91,10 @@ static int linedisp_display(struct linedisp *linedisp, const char *msg,
		return 0;
	}

	new_msg = kmalloc(count + 1, GFP_KERNEL);
	new_msg = kmemdup_nul(msg, count, GFP_KERNEL);
	if (!new_msg)
		return -ENOMEM;

	memcpy(new_msg, msg, count);
	new_msg[count] = 0;

	kfree(linedisp->message);

	linedisp->message = new_msg;