ocfs2: move from strlcpy with unused retval to strscpy
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 18 Aug 2022 21:01:13 +0000 (23:01 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 Sep 2022 04:55:09 +0000 (21:55 -0700)
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/
Link: https://lkml.kernel.org/r/20220818210123.7637-4-wsa+renesas@sang-engineering.com
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/stackglue.c
fs/ocfs2/super.c

index dd77b7aaabf5c942ce3c43a2cac9e21c1f83aeeb..317126261523b45ad3a03acd8199b7c4db7070c8 100644 (file)
@@ -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;
index e2cc9eec287c9bfcf8c33fc6e8b5893aa45818b7..660bc1795848a97dfab8ea5a1bc5668b4f5428ca 100644 (file)
@@ -2221,7 +2221,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);