Skip to content

Commit 13609a8

Browse files
Wolfram Sangsmfrench
authored andcommitted
cifs: 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/ Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent ca08d0e commit 13609a8

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

fs/cifs/cifsroot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static int __init cifs_root_setup(char *line)
5959
pr_err("Root-CIFS: UNC path too long\n");
6060
return 1;
6161
}
62-
strlcpy(root_dev, line, len);
62+
strscpy(root_dev, line, len);
6363
srvaddr = parse_srvaddr(&line[2], s);
6464
if (*s) {
6565
int n = snprintf(root_opts,

fs/cifs/connect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3994,7 +3994,7 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
39943994
}
39953995
bcc_ptr += length + 1;
39963996
bytes_left -= (length + 1);
3997-
strlcpy(tcon->treeName, tree, sizeof(tcon->treeName));
3997+
strscpy(tcon->treeName, tree, sizeof(tcon->treeName));
39983998

39993999
/* mostly informational -- no need to fail on error here */
40004000
kfree(tcon->nativeFileSystem);

fs/cifs/smb2pdu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,7 +1928,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
19281928
tcon->capabilities = rsp->Capabilities; /* we keep caps little endian */
19291929
tcon->maximal_access = le32_to_cpu(rsp->MaximalAccess);
19301930
tcon->tid = le32_to_cpu(rsp->hdr.Id.SyncId.TreeId);
1931-
strlcpy(tcon->treeName, tree, sizeof(tcon->treeName));
1931+
strscpy(tcon->treeName, tree, sizeof(tcon->treeName));
19321932

19331933
if ((rsp->Capabilities & SMB2_SHARE_CAP_DFS) &&
19341934
((tcon->share_flags & SHI1005_FLAGS_DFS) == 0))

0 commit comments

Comments
 (0)