Commit 13609a8b authored by Wolfram Sang's avatar Wolfram Sang Committed by Steve French
Browse files

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: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent ca08d0ea
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ static int __init cifs_root_setup(char *line)
			pr_err("Root-CIFS: UNC path too long\n");
			return 1;
		}
		strlcpy(root_dev, line, len);
		strscpy(root_dev, line, len);
		srvaddr = parse_srvaddr(&line[2], s);
		if (*s) {
			int n = snprintf(root_opts,
+1 −1
Original line number Diff line number Diff line
@@ -3994,7 +3994,7 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
		}
		bcc_ptr += length + 1;
		bytes_left -= (length + 1);
		strlcpy(tcon->treeName, tree, sizeof(tcon->treeName));
		strscpy(tcon->treeName, tree, sizeof(tcon->treeName));

		/* mostly informational -- no need to fail on error here */
		kfree(tcon->nativeFileSystem);
+1 −1
Original line number Diff line number Diff line
@@ -1928,7 +1928,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
	tcon->capabilities = rsp->Capabilities; /* we keep caps little endian */
	tcon->maximal_access = le32_to_cpu(rsp->MaximalAccess);
	tcon->tid = le32_to_cpu(rsp->hdr.Id.SyncId.TreeId);
	strlcpy(tcon->treeName, tree, sizeof(tcon->treeName));
	strscpy(tcon->treeName, tree, sizeof(tcon->treeName));

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