Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os 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>

authored by

Geert Uytterhoeven and committed by
Miguel Ojeda
364f2c39 7e76aece

+1 -4
+1 -4
drivers/auxdisplay/line-display.c
··· 91 91 return 0; 92 92 } 93 93 94 - new_msg = kmalloc(count + 1, GFP_KERNEL); 94 + new_msg = kmemdup_nul(msg, count, GFP_KERNEL); 95 95 if (!new_msg) 96 96 return -ENOMEM; 97 - 98 - memcpy(new_msg, msg, count); 99 - new_msg[count] = 0; 100 97 101 98 kfree(linedisp->message); 102 99