diff options
author | Xu Panda <xu.panda@zte.com.cn> | 2022-11-30 11:01:41 +0300 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2022-12-01 13:57:51 +0300 |
commit | 7365df19e8ff7a031e1557616fc0b3aa6d794d7e (patch) | |
tree | 46929269a8b6b2e1be2336e9bc2a57cab587a782 /kernel/printk | |
parent | 7b0592a23e4f27196f4ea207a926838e7651c5b5 (diff) | |
download | linux-7365df19e8ff7a031e1557616fc0b3aa6d794d7e.tar.xz |
printk: use strscpy() to instead of strlcpy()
The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL terminated strings.
Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/202211301601416229001@zte.com.cn
Diffstat (limited to 'kernel/printk')
-rw-r--r-- | kernel/printk/printk.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index e4f1e7478b52..eec87ddcaa45 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2391,7 +2391,7 @@ static int __add_preferred_console(char *name, int idx, char *options, return -E2BIG; if (!brl_options) preferred_console = i; - strlcpy(c->name, name, sizeof(c->name)); + strscpy(c->name, name, sizeof(c->name)); c->options = options; set_user_specified(c, user_specified); braille_set_options(c, brl_options); |