[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202211301601416229001@zte.com.cn>
Date: Wed, 30 Nov 2022 16:01:41 +0800 (CST)
From: <yang.yang29@....com.cn>
To: <pmladek@...e.com>
Cc: <senozhatsky@...omium.org>, <rostedt@...dmis.org>,
<john.ogness@...utronix.de>, <linux-kernel@...r.kernel.org>,
<xu.panda@....com.cn>, <yang.yang29@....com.cn>
Subject: [PATCH linux-next] printk: use strscpy() to instead of strlcpy()
From: Xu Panda <xu.panda@....com.cn>
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@....com.cn>
Signed-off-by: Yang Yang <yang.yang29@....com>
---
kernel/printk/printk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 9ec101766471..7decf1e9c486 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2480,7 +2480,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);
--
2.15.2
Powered by blists - more mailing lists