diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2011-04-27 15:28:44 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-04-27 16:17:29 -0400 |
commit | 613e901e1ee0e1096663b649eee8e5d6697919f3 (patch) | |
tree | 1a7c6c79585da11445de9c3b3c6c701d5c6c0195 /fs | |
parent | 28331a46d88459788c8fca72dbb0415cd7f514c9 (diff) |
NFS: Return meaningful status from decode_secinfo()
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 7310d2ec5de8..c3ccd2c46834 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -4836,6 +4836,8 @@ static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | |||
4836 | int i, num_flavors; | 4836 | int i, num_flavors; |
4837 | 4837 | ||
4838 | status = decode_op_hdr(xdr, OP_SECINFO); | 4838 | status = decode_op_hdr(xdr, OP_SECINFO); |
4839 | if (status) | ||
4840 | goto out; | ||
4839 | p = xdr_inline_decode(xdr, 4); | 4841 | p = xdr_inline_decode(xdr, 4); |
4840 | if (unlikely(!p)) | 4842 | if (unlikely(!p)) |
4841 | goto out_overflow; | 4843 | goto out_overflow; |
@@ -4854,14 +4856,15 @@ static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | |||
4854 | sec_flavor->flavor = be32_to_cpup(p); | 4856 | sec_flavor->flavor = be32_to_cpup(p); |
4855 | 4857 | ||
4856 | if (sec_flavor->flavor == RPC_AUTH_GSS) { | 4858 | if (sec_flavor->flavor == RPC_AUTH_GSS) { |
4857 | if (decode_secinfo_gss(xdr, sec_flavor)) | 4859 | status = decode_secinfo_gss(xdr, sec_flavor); |
4858 | break; | 4860 | if (status) |
4861 | goto out; | ||
4859 | } | 4862 | } |
4860 | res->flavors->num_flavors++; | 4863 | res->flavors->num_flavors++; |
4861 | } | 4864 | } |
4862 | 4865 | ||
4863 | return 0; | 4866 | out: |
4864 | 4867 | return status; | |
4865 | out_overflow: | 4868 | out_overflow: |
4866 | print_overflow_msg(__func__, xdr); | 4869 | print_overflow_msg(__func__, xdr); |
4867 | return -EIO; | 4870 | return -EIO; |