Skip to contentSkip to conversation

fs/cifs: fix gcc warning in sid_to_id

PATCH Applied Qiujun Huang 2 participants 2 messages Mar 4, 2020

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

PATCH 1/1 fs/cifs: fix gcc warning in sid_to_id

fix warning [-Wunused-but-set-variable] at variable 'rc', keeping the code readable.

---
 fs/cifs/cifsacl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/cifs/cifsacl.c +3 -2
index 716574a..ae42163 100644
@@ -342,7 +342,7 @@
 sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
 		struct cifs_fattr *fattr, uint sidtype)
 {
-	int rc;
+	int rc = 0;
 	struct key *sidkey;
 	char *sidstr;
 	const struct cred *saved_cred;
@@ -450,11 +450,12 @@
 	 * fails then we just fall back to using the mnt_uid/mnt_gid.
 	 */
 got_valid_id:
+	rc = 0;
 	if (sidtype == SIDOWNER)
 		fattr->cf_uid = fuid;
 	else
 		fattr->cf_gid = fgid;
-	return 0;
+	return rc;
 }
 
 int
Signature · 1 line
1.8.3.1
Applied
#1 lore raw

merged into cifs-2.6.git for-next

Quoted 39 lines · Qiujun Huang

fix warning [-Wunused-but-set-variable] at variable 'rc', keeping the code readable.

---
 fs/cifs/cifsacl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/cifs/cifsacl.c +3 -3
index 716574a..ae42163 100644
@@ -342,7 +342,7 @@
 sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
                struct cifs_fattr *fattr, uint sidtype)
 {
-       int rc;
+       int rc = 0;
        struct key *sidkey;
        char *sidstr;
        const struct cred *saved_cred;
@@ -450,11 +450,12 @@
         * fails then we just fall back to using the mnt_uid/mnt_gid.
         */
 got_valid_id:
+       rc = 0;
        if (sidtype == SIDOWNER)
                fattr->cf_uid = fuid;
        else
                fattr->cf_gid = fgid;
-       return 0;
+       return rc;
 }
 
 int
--

1.8.3.1

Signature · 3 lines
Thanks,

Steve