Message ID | 202211220858139474929@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1928496wrr; Mon, 21 Nov 2022 17:02:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+wUZ6KDISaLuKWgHMcxLiBT1Sbx4d0k2PKo1qeT8uTKBRxKVrPvJXUOiWsSrGw2RtLWBh X-Received: by 2002:a63:1e4b:0:b0:470:514e:1f12 with SMTP id p11-20020a631e4b000000b00470514e1f12mr20006321pgm.353.1669078950023; Mon, 21 Nov 2022 17:02:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669078950; cv=none; d=google.com; s=arc-20160816; b=qHYd9b+JMV52GG2MUbR0RVRyqHiaAUXbNMTHe6KlBgd5LtRqslkcoMcxVEh6La2EDa WIsAd72pIluXKmopdy3T8GQttvqlDH+yV1JK4JxLYasta2ny5ALJxE5Y5IZlt2K2bGNS pGiHKqEkunhhxv1LqYPFXmCjLyx5+e/hUXOiDePlKzSIvHtIauAQko26S88AImoDH2XS hOlxMUvAruh0vrsjcAZ0JU/ljkuUv/MwwtKOSBrBU/st0f0VlvbX2KsO+l9RG+w+Pbnf UVw0ZJQifqSfbdgdqbXCvNIeJ+oHQJFi6WWVREA2EucfCvxv6fhp5W9jEhK3RpCsFwoT /6WQ== 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=e/pjlcFpwOsq9IBVvrvrl0b7LffjxTRmXkiYJk1uIcQ=; b=gnXwW8bHmNttld27cjVPIZYKv8lQvKEhjuGJqrgDu70aXdCUupdM3SPMrOeGNFYxq5 Lt9qYlm48vV6ryMkntLquSnsR1JgqDO+DYBqgiV1oqNvM8LIPcSr8+81yKGuF3YLipRt Fmu1RSTX0joYfgzzQmquaNtrMwGXk4R13Xzgmh7SAKBTbt+8cbeOQvstIp79aSbkgaGy BuSLc94QXp0KrZyrD5zIra/HyxkQxJCdWey4VoGAHKKoMMyjyGEZ6NmChVc8jy0/Ba8a pBoYjiuaE8cwSWtmhefZIG3s8hDcAI2Mz5xq2Y4NbAXscV/bvF5tVsdw3ezoM7zpgQqH Sf+w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lw6-20020a17090b180600b0020d65f31df8si19653168pjb.143.2022.11.21.17.02.16; Mon, 21 Nov 2022 17:02:30 -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 S231519AbiKVA61 (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Mon, 21 Nov 2022 19:58:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229721AbiKVA6X (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 21 Nov 2022 19:58:23 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F401568C4E; Mon, 21 Nov 2022 16:58:19 -0800 (PST) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4NGQqG0KGfz4xVnf; Tue, 22 Nov 2022 08:58:18 +0800 (CST) Received: from szxlzmapp01.zte.com.cn ([10.5.231.85]) by mse-fl2.zte.com.cn with SMTP id 2AM0wDIn085676; Tue, 22 Nov 2022 08:58:13 +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:58:13 +0800 (CST) Date: Tue, 22 Nov 2022 08:58:13 +0800 (CST) X-Zmail-TransId: 2b04637c1ea5ffffffff854dfe8c X-Mailer: Zmail v1.0 Message-ID: <202211220858139474929@zte.com.cn> Mime-Version: 1.0 From: <yang.yang29@zte.com.cn> To: <hdegoede@redhat.com> Cc: <linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <xu.panda@zte.com.cn>, <yang.yang29@zte.com.cn> Subject: =?utf-8?q?=5BPATCH_linux-next=5D_vboxfs=3A_use_strscpy=28=29_is_mor?= =?utf-8?q?e_robust_and_safer?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 2AM0wDIn085676 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 637C1EAA.000 by FangMail milter! X-FangMail-Envelope: 1669078698/4NGQqG0KGfz4xVnf/637C1EAA.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/<yang.yang29@zte.com.cn> X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 637C1EAA.000/4NGQqG0KGfz4xVnf 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750156129406434624?= X-GMAIL-MSGID: =?utf-8?q?1750156129406434624?= |
Series |
[linux-next] vboxfs: use strscpy() is more robust and safer
|
|
Commit Message
Yang Yang
Nov. 22, 2022, 12:58 a.m. UTC
From: Xu Panda <xu.panda@zte.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@zte.com.cn> Signed-off-by: Yang Yang <yang.yang29@zte.com> --- fs/vboxsf/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi, On 11/22/22 01:58, yang.yang29@zte.com.cn wrote: > From: Xu Panda <xu.panda@zte.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@zte.com.cn> > Signed-off-by: Yang Yang <yang.yang29@zte.com> Thanks, patch looks good to me: Reviewed-by: Hans de Goede <hdegoede@redhat.com> Regards, Hans > --- > fs/vboxsf/super.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/vboxsf/super.c b/fs/vboxsf/super.c > index d2f6df69f611..1fb8f4df60cb 100644 > --- a/fs/vboxsf/super.c > +++ b/fs/vboxsf/super.c > @@ -176,7 +176,7 @@ static int vboxsf_fill_super(struct super_block *sb, struct fs_context *fc) > } > folder_name->size = size; > folder_name->length = size - 1; > - strlcpy(folder_name->string.utf8, fc->source, size); > + strscpy(folder_name->string.utf8, fc->source, size); > err = vboxsf_map_folder(folder_name, &sbi->root); > kfree(folder_name); > if (err) {
diff --git a/fs/vboxsf/super.c b/fs/vboxsf/super.c index d2f6df69f611..1fb8f4df60cb 100644 --- a/fs/vboxsf/super.c +++ b/fs/vboxsf/super.c @@ -176,7 +176,7 @@ static int vboxsf_fill_super(struct super_block *sb, struct fs_context *fc) } folder_name->size = size; folder_name->length = size - 1; - strlcpy(folder_name->string.utf8, fc->source, size); + strscpy(folder_name->string.utf8, fc->source, size); err = vboxsf_map_folder(folder_name, &sbi->root); kfree(folder_name); if (err) {