From mboxrd@z Thu Jan 1 00:00:00 1970 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 CA6B9C00140 for ; Sun, 21 Aug 2022 13:24:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229481AbiHUNYl (ORCPT ); Sun, 21 Aug 2022 09:24:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230016AbiHUNYh (ORCPT ); Sun, 21 Aug 2022 09:24:37 -0400 Received: from out199-8.us.a.mail.aliyun.com (out199-8.us.a.mail.aliyun.com [47.90.199.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46B831E3F6 for ; Sun, 21 Aug 2022 06:24:34 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R551e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VMnWTjg_1661088269; Received: from 30.0.165.201(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0VMnWTjg_1661088269) by smtp.aliyun-inc.com; Sun, 21 Aug 2022 21:24:30 +0800 Message-ID: <71c6c3cd-5022-dd7c-d8d0-d1c354c85f13@linux.alibaba.com> Date: Sun, 21 Aug 2022 21:24:29 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH 04/14] ocfs2: move from strlcpy with unused retval to strscpy Content-Language: en-US To: Wolfram Sang , linux-kernel@vger.kernel.org, akpm Cc: Mark Fasheh , Joel Becker , ocfs2-devel@oss.oracle.com References: <20220818210123.7637-1-wsa+renesas@sang-engineering.com> <20220818210123.7637-4-wsa+renesas@sang-engineering.com> From: Joseph Qi In-Reply-To: <20220818210123.7637-4-wsa+renesas@sang-engineering.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/19/22 5:01 AM, Wolfram Sang wrote: > Follow the advice of the below link and prefer 'strscpy' in this > subsystem. Conversion is 1:1 because the return value is not used. > Generated by a coccinelle script. > > Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ > Signed-off-by: Wolfram Sang Acked-by: Joseph Qi > --- > fs/ocfs2/stackglue.c | 4 ++-- > fs/ocfs2/super.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c > index dd77b7aaabf5..317126261523 100644 > --- a/fs/ocfs2/stackglue.c > +++ b/fs/ocfs2/stackglue.c > @@ -334,10 +334,10 @@ int ocfs2_cluster_connect(const char *stack_name, > goto out; > } > > - strlcpy(new_conn->cc_name, group, GROUP_NAME_MAX + 1); > + strscpy(new_conn->cc_name, group, GROUP_NAME_MAX + 1); > new_conn->cc_namelen = grouplen; > if (cluster_name_len) > - strlcpy(new_conn->cc_cluster_name, cluster_name, > + strscpy(new_conn->cc_cluster_name, cluster_name, > CLUSTER_NAME_MAX + 1); > new_conn->cc_cluster_name_len = cluster_name_len; > new_conn->cc_recovery_handler = recovery_handler; > diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c > index 013a727bd7c8..ec46489b6c7e 100644 > --- a/fs/ocfs2/super.c > +++ b/fs/ocfs2/super.c > @@ -2222,7 +2222,7 @@ static int ocfs2_initialize_super(struct super_block *sb, > goto out_journal; > } > > - strlcpy(osb->vol_label, di->id2.i_super.s_label, > + strscpy(osb->vol_label, di->id2.i_super.s_label, > OCFS2_MAX_VOL_LABEL_LEN); > osb->root_blkno = le64_to_cpu(di->id2.i_super.s_root_blkno); > osb->system_dir_blkno = le64_to_cpu(di->id2.i_super.s_system_dir_blkno);