Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ocfs2: move from strlcpy with unused retval to strscpy

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>

authored by

Wolfram Sang and committed by
Andrew Morton
c97e21fe 216e71f1

+3 -3
+2 -2
fs/ocfs2/stackglue.c
··· 334 334 goto out; 335 335 } 336 336 337 - strlcpy(new_conn->cc_name, group, GROUP_NAME_MAX + 1); 337 + strscpy(new_conn->cc_name, group, GROUP_NAME_MAX + 1); 338 338 new_conn->cc_namelen = grouplen; 339 339 if (cluster_name_len) 340 - strlcpy(new_conn->cc_cluster_name, cluster_name, 340 + strscpy(new_conn->cc_cluster_name, cluster_name, 341 341 CLUSTER_NAME_MAX + 1); 342 342 new_conn->cc_cluster_name_len = cluster_name_len; 343 343 new_conn->cc_recovery_handler = recovery_handler;
+1 -1
fs/ocfs2/super.c
··· 2221 2221 goto out_journal; 2222 2222 } 2223 2223 2224 - strlcpy(osb->vol_label, di->id2.i_super.s_label, 2224 + strscpy(osb->vol_label, di->id2.i_super.s_label, 2225 2225 OCFS2_MAX_VOL_LABEL_LEN); 2226 2226 osb->root_blkno = le64_to_cpu(di->id2.i_super.s_root_blkno); 2227 2227 osb->system_dir_blkno = le64_to_cpu(di->id2.i_super.s_system_dir_blkno);