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

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
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment