diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2021-10-19 17:45:06 +0300 |
---|---|---|
committer | Miguel Ojeda <ojeda@kernel.org> | 2021-10-22 00:36:29 +0300 |
commit | 364f2c392f2b38ba3c52933f11a8dbee71f28864 (patch) | |
tree | 61765b33e4ac7a3e0cf851256459f789fa1413b5 /drivers/auxdisplay | |
parent | 7e76aece6f036cb7ada4858d6aa73825bfe22983 (diff) | |
download | linux-364f2c392f2b38ba3c52933f11a8dbee71f28864.tar.xz |
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>
Diffstat (limited to 'drivers/auxdisplay')
-rw-r--r-- | drivers/auxdisplay/line-display.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c index 4b97c20ac0b3..3f35199bc39f 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -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; |