Skip to contentSkip to conversation

smb: client: Return a status code only as a constant in sid_to_id()

PATCH Applied Markus Elfring 2 participants 2 messages Oct 10, 2025 – Oct 11, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smb: client: Return a status code only as a constant in sid_to_id()

From: Markus Elfring <[email protected]>
Date: Fri, 10 Oct 2025 21:04:16 +0200

Return a status code without storing it in an intermediate variable.

This issue was detected by using the Coccinelle software.

---
 fs/smb/client/cifsacl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/smb/client/cifsacl.c +2 -3
index 63b3b1290bed..ce2ebc213a1d 100644
@@ -339,7 +339,6 @@ int
 sid_to_id(struct cifs_sb_info *cifs_sb, struct smb_sid *psid,
 		struct cifs_fattr *fattr, uint sidtype)
 {
-	int rc = 0;
 	struct key *sidkey;
 	char *sidstr;
 	const struct cred *saved_cred;
@@ -446,12 +445,12 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct smb_sid *psid,
 	 * fails then we just fall back to using the ctx->linux_uid/linux_gid.
 	 */
 got_valid_id:
-	rc = 0;
 	if (sidtype == SIDOWNER)
 		fattr->cf_uid = fuid;
 	else
 		fattr->cf_gid = fgid;
-	return rc;
+
+	return 0;
 }
 
 int
Signature · 1 line
2.51.0
Applied
#1 lore raw

merged into cifs-2.6.git for-next

Quoted 44 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Fri, 10 Oct 2025 21:04:16 +0200

Return a status code without storing it in an intermediate variable.

This issue was detected by using the Coccinelle software.

---
 fs/smb/client/cifsacl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/smb/client/cifsacl.c +2 -4
index 63b3b1290bed..ce2ebc213a1d 100644
@@ -339,7 +339,6 @@ int
 sid_to_id(struct cifs_sb_info *cifs_sb, struct smb_sid *psid,
                struct cifs_fattr *fattr, uint sidtype)
 {
-       int rc = 0;
        struct key *sidkey;
        char *sidstr;
        const struct cred *saved_cred;
@@ -446,12 +445,12 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct smb_sid *psid,
         * fails then we just fall back to using the ctx->linux_uid/linux_gid.
         */
 got_valid_id:
-       rc = 0;
        if (sidtype == SIDOWNER)
                fattr->cf_uid = fuid;
        else
                fattr->cf_gid = fgid;
-       return rc;
+
+       return 0;
 }
 
 int
--

2.51.0

Signature · 3 lines
Thanks,

Steve