From nobody Fri Sep 19 02:32:03 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 934D4C4321E for ; Wed, 30 Nov 2022 08:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234363AbiK3ICM (ORCPT ); Wed, 30 Nov 2022 03:02:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234406AbiK3ICB (ORCPT ); Wed, 30 Nov 2022 03:02:01 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B4E142F7A for ; Wed, 30 Nov 2022 00:01:58 -0800 (PST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4NMWrP1Z55z4xyCY; Wed, 30 Nov 2022 16:01:57 +0800 (CST) Received: from szxlzmapp01.zte.com.cn ([10.5.231.85]) by mse-fl1.zte.com.cn with SMTP id 2AU81dm3026906; Wed, 30 Nov 2022 16:01:39 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp02[null]) by mapi (Zmail) with MAPI id mid14; Wed, 30 Nov 2022 16:01:41 +0800 (CST) Date: Wed, 30 Nov 2022 16:01:41 +0800 (CST) X-Zmail-TransId: 2b0463870de5ffffffffa0535c37 X-Mailer: Zmail v1.0 Message-ID: <202211301601416229001@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , Subject: =?UTF-8?B?W1BBVENIIGxpbnV4LW5leHRdIHByaW50azogdXNlIHN0cnNjcHkoKSB0byBpbnN0ZWFkIG9mIHN0cmxjcHkoKQ==?= X-MAIL: mse-fl1.zte.com.cn 2AU81dm3026906 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 63870DF5.000 by FangMail milter! X-FangMail-Envelope: 1669795317/4NMWrP1Z55z4xyCY/63870DF5.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63870DF5.000/4NMWrP1Z55z4xyCY Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Xu Panda 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 Signed-off-by: Yang Yang Reviewed-by: Petr Mladek --- 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 id= x, char *options, return -E2BIG; if (!brl_options) preferred_console =3D i; - strlcpy(c->name, name, sizeof(c->name)); + strscpy(c->name, name, sizeof(c->name)); c->options =3D options; set_user_specified(c, user_specified); braille_set_options(c, brl_options); --=20 2.15.2