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>
This commit is contained in:
Dmitry Antipov 2026-07-27 20:20:35 +03:00 committed by Steve French
parent 9388e7c820
commit b476724a6d

View File

@ -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)