Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5122000rwb; Mon, 21 Nov 2022 17:11:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf4yO2XHql3lX64MG+DUVntsf8212XY2JFMqEqoffHlsnIpDWcPeHHiHdUcgYm95c1KXOpzE X-Received: by 2002:a05:6402:b1a:b0:469:15eb:71b5 with SMTP id bm26-20020a0564020b1a00b0046915eb71b5mr13876310edb.312.1669079469455; Mon, 21 Nov 2022 17:11:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669079469; cv=none; d=google.com; s=arc-20160816; b=lATeN0UhZKoig3gBXDYN31YQyyzvXb/c+2tqNrt6CdysyPHUnHkmpF6YO/tNk1/BRi zJNmpAkoz55grKirvVH75KTsv0YykLa/ruoX+5622dNbaEaJX9tO2v5q+vaiHgTjWfq3 leHvfiI0l+dUAhPIBObjmSah4f6R7eVTiUOynQ6tc7/ryqn7VRWUCaHe4y33v6Vw9KRo Am35egk4sv8w81m5+7aclwg7BYMBnsT5ksydsZhtp2y9/MHyKiPkvxp4oDwVdOVJ12fc F7feLhtbj7+vJvgpSBugvxYbuJ3/E5IrUxLD1TSPJN8B21S6eJAUQ5Sxhr0jzkZJzPAS 7XSA== 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=xxtm0Fe6Wl/kMnPtZbjy1O8xAqbxdzYM2Zr0qCuBDMg=; b=UjDW1sMyNos7yAJxJGVs3+clSHfcOxDKi+rY4C9wTNQ9eIydRZlCMfK6lOtZArGB9J d4T/FuS5AxR2w7KDie8kEg0WDe50aM1YAP66rliwtg5uGhZ8bMZgGsZwKETHNqftthEC GMm0a2WRvMa+PAGiVNTUcRvZNCFe6XXsL1VtUfr0fWvVzhDts7XScaBEuG6Joh4tcW42 Tl7MUoq2CRWcyO47blCbXVydFRMX5D/8LoqiPg8ZCOeRQfSdlToZypwi29UyPS+wyaID IjBdCNNjEtRfQPKfIl9bzz+XKvwGFJgX/TSxyUsarCcs75O009lT8FrRm3StYSsgdgXG TDhA== 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 sg34-20020a170907a42200b00791a7e441a3si11483710ejc.459.2022.11.21.17.10.41; Mon, 21 Nov 2022 17:11:09 -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 S231441AbiKVAxv (ORCPT + 91 others); Mon, 21 Nov 2022 19:53:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231758AbiKVAxh (ORCPT ); Mon, 21 Nov 2022 19:53:37 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45AB9DEAEE for ; Mon, 21 Nov 2022 16:53:35 -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 4NGQjn3KKtz4y0vF; Tue, 22 Nov 2022 08:53:33 +0800 (CST) Received: from szxlzmapp05.zte.com.cn ([10.5.230.85]) by mse-fl1.zte.com.cn with SMTP id 2AM0rO5p080247; Tue, 22 Nov 2022 08:53:24 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp02[null]) by mapi (Zmail) with MAPI id mid14; Tue, 22 Nov 2022 08:53:25 +0800 (CST) Date: Tue, 22 Nov 2022 08:53:25 +0800 (CST) X-Zmail-TransId: 2b04637c1d85ffffffffda7cd3f2 X-Mailer: Zmail v1.0 Message-ID: <202211220853259244666@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , Subject: =?UTF-8?B?W1BBVENIIGxpbnV4LW5leHRdIHJlbGF5OiB1c2Ugc3Ryc2NweSgpIGlzIG1vcmUgcm9idXN0IGFuZCBzYWZlcg==?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2AM0rO5p080247 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 637C1D8D.000 by FangMail milter! X-FangMail-Envelope: 1669078413/4NGQjn3KKtz4y0vF/637C1D8D.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 637C1D8D.000/4NGQjn3KKtz4y0vF 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/relay.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/relay.c b/kernel/relay.c index d7edc934c56d..0a3d2e702001 100644 --- a/kernel/relay.c +++ b/kernel/relay.c @@ -507,7 +507,7 @@ struct rchan *relay_open(const char *base_filename, chan->private_data = private_data; if (base_filename) { chan->has_base_filename = 1; - strlcpy(chan->base_filename, base_filename, NAME_MAX); + strscpy(chan->base_filename, base_filename, NAME_MAX); } chan->cb = cb; kref_init(&chan->kref); @@ -578,7 +578,7 @@ int relay_late_setup_files(struct rchan *chan, if (!chan || !base_filename) return -EINVAL; - strlcpy(chan->base_filename, base_filename, NAME_MAX); + strscpy(chan->base_filename, base_filename, NAME_MAX); mutex_lock(&relay_channels_mutex); /* Is chan already set up? */ -- 2.15.2