Skip to contentSkip to conversation

cifs: fix error handling when cifscreds key payload is an error

PATCH In review Jeff Layton 3 participants 3 messages Jan 20, 2012 – Jan 25, 2012 2 messages not in the archive

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

PATCH 1/1 cifs: fix error handling when cifscreds key payload is an error

---
 fs/cifs/connect.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/cifs/connect.c +1 -1
index 986709a..aa687c8 100644
@@ -2125,7 +2125,7 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
 	down_read(&key->sem);
 	upayload = key->payload.data;
 	if (IS_ERR_OR_NULL(upayload)) {
-		rc = PTR_ERR(key);
+		rc = upayload ? PTR_ERR(upayload) : -EINVAL;
 		goto out_key_put;
 	}
 
Signature · 1 line
1.7.7.5
#2 lore raw
In reply to a message not in the archive

Looks reasonable. Was this found by static code analysis?

Quoted 22 lines · Jeff Layton

---
 fs/cifs/connect.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
fs/cifs/connect.c +1 -2
index 986709a..aa687c8 100644
@@ -2125,7 +2125,7 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
        down_read(&key->sem);
        upayload = key->payload.data;
        if (IS_ERR_OR_NULL(upayload)) {
-               rc = PTR_ERR(key);
+               rc = upayload ? PTR_ERR(upayload) : -EINVAL;
                goto out_key_put;
        }
 
--

1.7.7.5

Signature · 3 lines
Thanks,

Steve
#4 lore raw
In reply to a message not in the archive
Quoted 2 lines · Steve French

Looks reasonable. Was this found by static code analysis?

I saw this in reading the code for something else. But it should be a static checker thing, definitely. I'm writing a check for that now.

regards,
dan carpenter