Skip to content

Commit

Permalink
NFS: Return meaningful status from decode_secinfo()
Browse files Browse the repository at this point in the history
When compiling, I was getting this warning:
fs/nfs/nfs4xdr.c: In function ‘decode_secinfo’:
fs/nfs/nfs4xdr.c:4839:6: warning: variable ‘status’ set but not used
[-Wunused-but-set-variable]

We were unconditionally returning 0 as long as there wasn't an error
coming out of xdr_inline_decode().  We probably want to check the error
status coming out of decode_op_hdr() and decode_secinfo_gss(), rather
than assuming that everything is OK all the time.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Bryan Schumaker authored and Trond Myklebust committed Apr 27, 2011
1 parent 28331a4 commit 613e901
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fs/nfs/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -4836,6 +4836,8 @@ static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res)
int i, num_flavors;

status = decode_op_hdr(xdr, OP_SECINFO);
if (status)
goto out;
p = xdr_inline_decode(xdr, 4);
if (unlikely(!p))
goto out_overflow;
Expand All @@ -4854,14 +4856,15 @@ static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res)
sec_flavor->flavor = be32_to_cpup(p);

if (sec_flavor->flavor == RPC_AUTH_GSS) {
if (decode_secinfo_gss(xdr, sec_flavor))
break;
status = decode_secinfo_gss(xdr, sec_flavor);
if (status)
goto out;
}
res->flavors->num_flavors++;
}

return 0;

out:
return status;
out_overflow:
print_overflow_msg(__func__, xdr);
return -EIO;
Expand Down

0 comments on commit 613e901

Please sign in to comment.