Skip to content

Commit 613e901

Browse files
Bryan SchumakerTrond Myklebust
authored andcommitted
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 <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent 28331a4 commit 613e901

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

fs/nfs/nfs4xdr.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4836,6 +4836,8 @@ static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res)
48364836
int i, num_flavors;
48374837

48384838
status = decode_op_hdr(xdr, OP_SECINFO);
4839+
if (status)
4840+
goto out;
48394841
p = xdr_inline_decode(xdr, 4);
48404842
if (unlikely(!p))
48414843
goto out_overflow;
@@ -4854,14 +4856,15 @@ static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res)
48544856
sec_flavor->flavor = be32_to_cpup(p);
48554857

48564858
if (sec_flavor->flavor == RPC_AUTH_GSS) {
4857-
if (decode_secinfo_gss(xdr, sec_flavor))
4858-
break;
4859+
status = decode_secinfo_gss(xdr, sec_flavor);
4860+
if (status)
4861+
goto out;
48594862
}
48604863
res->flavors->num_flavors++;
48614864
}
48624865

4863-
return 0;
4864-
4866+
out:
4867+
return status;
48654868
out_overflow:
48664869
print_overflow_msg(__func__, xdr);
48674870
return -EIO;

0 commit comments

Comments
 (0)