cifs: fix error code in cifs_match_super()
Subsystems (3)
PATCH 1/1 cifs: fix error code in cifs_match_super()
It looks like there is a typo here where return "rc" which is "success" instead of PTR_ERR(tlink) which is a negative error code.
I have also removed the unneeded initialization so that GCC has a chance to warn about this sort of thing next time.
---
This is a static checker warning and I'm not certain this is the correct fix. Please review this one carefully.
fs/cifs/connect.c +2 -2
@@ -2730,14 +2730,14 @@ cifs_match_super(struct super_block *sb, void *data)struct cifs_ses *ses;struct cifs_tcon *tcon;struct tcon_link *tlink; -int rc =0 ; +int rc;spin_lock (&cifs_tcp_ses_lock); cifs_sb =CIFS_SB (sb); tlink =cifs_get_tlink (cifs_sb_master_tlink (cifs_sb));if (IS_ERR (tlink)) {spin_unlock (&cifs_tcp_ses_lock); -return rc; +return PTR_ERR (tlink); } tcon =tlink_tcon (tlink); ses = tcon->ses;
I do not think his is correct. cifs_match_super return code is used as a test by sb_get,
so if there is any error/mismatch within cifs_match_super, it should return 0. 'if (test)' in sb_get() will succeed with PTR_ERR(tlink) which would be incorrect.
Quoted 33 lines · Dan Carpenter
It looks like there is a typo here where return "rc" which is "success" instead of
PTR_ERR(tlink)which is a negative error code.I have also removed the unneeded initialization so that GCC has a chance to warn about this sort of thing next time.
Fixes 25c7f41e9234 ('CIFS: Migrate to shared superblock model')Signed-off-by Dan Carpenter <[email protected]>---
This is a static checker warning and I'm not certain this is the correct fix. Please review this one carefully.fs/cifs/connect.c +2
-2@@ -2730,14 +2730,14 @@ cifs_match_super(struct super_block *sb, void *data)struct cifs_ses *ses;struct cifs_tcon *tcon;struct tcon_link *tlink; -int rc =0 ; +int rc;spin_lock (&cifs_tcp_ses_lock); cifs_sb =CIFS_SB (sb); tlink =cifs_get_tlink (cifs_sb_master_tlink (cifs_sb));if (IS_ERR (tlink)) {spin_unlock (&cifs_tcp_ses_lock); -return rc; +return PTR_ERR (tlink); } tcon =tlink_tcon (tlink); ses = tcon->ses;