aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-10-24 11:52:55 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-10-24 13:18:04 -0400
commit9af8c222ca5eae88f000664f693316480bf58fbc (patch)
tree4b5f49ab95cd07884ef1b51cda671a18c3dd4a3d /fs/nfs
parent4f082222fad3c8471abe0c8e8f18c72f335a34c7 (diff)
NFSv4: Clean up nfs4_decode_dirent
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4xdr.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 9bf5e66d11db..4c43e4874c52 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -5803,11 +5803,10 @@ __be32 *nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
5803 p = xdr_decode_hyper(p, &entry->cookie); 5803 p = xdr_decode_hyper(p, &entry->cookie);
5804 entry->len = ntohl(*p++); 5804 entry->len = ntohl(*p++);
5805 5805
5806 p = xdr_inline_decode(xdr, entry->len + 4); 5806 p = xdr_inline_decode(xdr, entry->len);
5807 if (unlikely(!p)) 5807 if (unlikely(!p))
5808 goto out_overflow; 5808 goto out_overflow;
5809 entry->name = (const char *) p; 5809 entry->name = (const char *) p;
5810 p += XDR_QUADLEN(entry->len);
5811 5810
5812 /* 5811 /*
5813 * In case the server doesn't return an inode number, 5812 * In case the server doesn't return an inode number,
@@ -5817,30 +5816,19 @@ __be32 *nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
5817 entry->ino = 1; 5816 entry->ino = 1;
5818 entry->fattr->valid = 0; 5817 entry->fattr->valid = 0;
5819 5818
5820 len = ntohl(*p++); /* bitmap length */ 5819 if (decode_attr_bitmap(xdr, bitmap) < 0)
5821 if (len-- > 0) { 5820 goto out_overflow;
5822 p = xdr_inline_decode(xdr, 4); 5821
5823 if (unlikely(!p)) 5822 if (decode_attr_length(xdr, &len, &p) < 0)
5824 goto out_overflow; 5823 goto out_overflow;
5825 bitmap[0] = ntohl(*p++); 5824
5826 if (len-- > 0) { 5825 if (decode_getfattr_attrs(xdr, bitmap, entry->fattr, entry->fh, server, 1) < 0)
5827 p = xdr_inline_decode(xdr, 4); 5826 goto out_overflow;
5828 if (unlikely(!p)) 5827 if (entry->fattr->valid & NFS_ATTR_FATTR_FILEID)
5829 goto out_overflow; 5828 entry->ino = entry->fattr->fileid;
5830 bitmap[1] = ntohl(*p++); 5829
5831 p += len; 5830 if (verify_attr_len(xdr, p, len) < 0)
5832 }
5833 }
5834 p = xdr_inline_decode(xdr, 4);
5835 if (unlikely(!p))
5836 goto out_overflow; 5831 goto out_overflow;
5837 len = XDR_QUADLEN(ntohl(*p++)); /* attribute buffer length */
5838 if (len > 0) {
5839 if (decode_getfattr_attrs(xdr, bitmap, entry->fattr, entry->fh, server, 1) < 0)
5840 goto out_overflow;
5841 if (entry->fattr->valid & NFS_ATTR_FATTR_FILEID)
5842 entry->ino = entry->fattr->fileid;
5843 }
5844 5832
5845 p = xdr_inline_peek(xdr, 8); 5833 p = xdr_inline_peek(xdr, 8);
5846 if (p != NULL) 5834 if (p != NULL)