* [PATCH] NFS: Return meaningful status from decode_secinfo()
@ 2011-04-27 18:53 bjschuma
0 siblings, 0 replies; only message in thread
From: bjschuma @ 2011-04-27 18:53 UTC (permalink / raw)
To: Trond.Myklebust; +Cc: linux-nfs, Bryan Schumaker
From: Bryan Schumaker <bjschuma@netapp.com>
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>
---
fs/nfs/nfs4xdr.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index dddfb57..58768f9 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -4841,6 +4841,9 @@ static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res)
int i;
status = decode_op_hdr(xdr, OP_SECINFO);
+ if (status)
+ goto out;
+
p = xdr_inline_decode(xdr, 4);
if (unlikely(!p))
goto out_overflow;
@@ -4857,13 +4860,14 @@ 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))
+ status = decode_secinfo_gss(xdr, sec_flavor);
+ if (status)
break;
}
}
- return 0;
-
+out:
+ return status;
out_overflow:
print_overflow_msg(__func__, xdr);
return -EIO;
--
1.7.4.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-04-27 18:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-27 18:53 [PATCH] NFS: Return meaningful status from decode_secinfo() bjschuma
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.