summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2026-07-27 20:20:35 +0300
committerSteve French <stfrench@microsoft.com>2026-07-27 18:12:16 -0500
commitb476724a6d9b2e7db43cb7a59defd396f94cf77c (patch)
treecf805ace19955d2685bc4131c3bcf0148acb480e
parent9388e7c820e33d3a7dfde9a9c16ad4ac60f29d37 (diff)
downloadlinux-next-b476724a6d9b2e7db43cb7a59defd396f94cf77c.tar.gz
linux-next-b476724a6d9b2e7db43cb7a59defd396f94cf77c.zip
smb: client: simplify cifs_fscache_get_super_cookie()
Avoid redundant 'strlen()' and use the convenient 'strreplace()' to simplify 'cifs_fscache_get_super_cookie()'. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/smb/client/fscache.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/smb/client/fscache.c b/fs/smb/client/fscache.c
index 01424a5cdb99..9f66bbcd3801 100644
--- a/fs/smb/client/fscache.c
+++ b/fs/smb/client/fscache.c
@@ -38,7 +38,6 @@ int cifs_fscache_get_super_cookie(struct cifs_tcon *tcon)
struct TCP_Server_Info *server = tcon->ses->server;
struct fscache_volume *vcookie;
const struct sockaddr *sa = (struct sockaddr *)&server->dstaddr;
- size_t slen, i;
char *sharename;
char *key;
int ret = -ENOMEM;
@@ -73,10 +72,7 @@ int cifs_fscache_get_super_cookie(struct cifs_tcon *tcon)
return PTR_ERR(sharename);
}
- slen = strlen(sharename);
- for (i = 0; i < slen; i++)
- if (sharename[i] == '/')
- sharename[i] = ';';
+ strreplace(sharename, '/', ';');
key = kasprintf(GFP_KERNEL, "cifs,%pISpc,%s", sa, sharename);
if (!key)