forked from Minki/linux
auxdisplay: linedisp: Use kmemdup_nul() helper
Use the existing kmemdup_nul() helper instead of open-coding the same operation. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
parent
7e76aece6f
commit
364f2c392f
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user