Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2005685rwb; Wed, 30 Nov 2022 00:36:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf5lBUnSAz+IqeSy5hn8l9ZZSF44qiRbyzd3vrEiokLcHY5B+sZ2F4jFjbM4lBld9JZdHwtt X-Received: by 2002:a63:2c05:0:b0:477:ceeb:cb9c with SMTP id s5-20020a632c05000000b00477ceebcb9cmr25976127pgs.17.1669797365523; Wed, 30 Nov 2022 00:36:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669797365; cv=none; d=google.com; s=arc-20160816; b=Mz+6mCKiafcyQJOrMJv4K39yBfrlFLYsA9fiMiaPOM4Hwt+ilPdRT3TzRcxEvRhNY+ f1peX98loVOKa8TbY759JSENnWGHzyjnBv58xgrtrSkQQ0/sHIxYBCRjJlTvWjoN7mQc vTVeEnQSSB0bmVp7gQc94NvMe/C2S+GiAchx1mc4TKVGxjc9RpXP7RdaifR1Nc00d6o6 tLxdQSxfnR+ZlIaU/n5+fpz4bS0869h2tE82SDbTU2CnU3pCDMUopU2+sci4cZTYh2Qh 2q7JPtDjnJhMEYvI8uQLc+rXnNEW332r9tvHWdRuFFAbN3RrL3nJZHP3PG75RDGyxfdw NKMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=8XkMbweouitK2zpYNdtXWGETMTbQJQi1KqFeVFEuqHU=; b=H00COoAu/6Eg9Fsi2KA0d1IDpE8G55PWur+XSY6KZ5+n94Vx4D1+51nfubfCJBuqu6 egpAKl/6Um/lIg7DhlCPuKsa9aFaR1nz6axCaQomclDMPE7KzlE48X2w8XeTrAL3gELA VaJPMSp0KV2tiyU0U8hkKjKTy2PUiaNDWQOro14dslwsgG5hBlXm/pWkoPyLmwUlprv7 yfOK4C6YFR6u1CK3gUOA8FikVFzk4Jqn8b45Qxr/c6OsjcVgTjJEZEeBUqJtet/1i/zo 2U33hDDLQQ11RCaYn6ItrF/TPtYqNFS2fkfhXaN9k6AV3rq8dJY4ESpGPMsp6bVQsg8q IEAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l14-20020a63570e000000b0047704a39c4asi686797pgb.504.2022.11.30.00.35.54; Wed, 30 Nov 2022 00:36:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234345AbiK3ICL (ORCPT + 84 others); Wed, 30 Nov 2022 03:02:11 -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==?= Content-Type: text/plain; charset="UTF-8" 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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