Skip to content

Commit 6b9c108

Browse files
committed
NFSD: Remove unused results in nfsd4_encode_pathname4()
Clean up. The result of "*p++" is saved, but is not used before it is overwritten. The result of xdr_encode_opaque() is saved each time through the loop but is never used. Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 1e02c64 commit 6b9c108

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

fs/nfsd/nfs4xdr.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2699,7 +2699,6 @@ static __be32 nfsd4_encode_pathname4(struct xdr_stream *xdr,
26992699
const struct path *path)
27002700
{
27012701
struct path cur = *path;
2702-
__be32 *p;
27032702
struct dentry **components = NULL;
27042703
unsigned int ncomponents = 0;
27052704
__be32 err = nfserr_jukebox;
@@ -2730,24 +2729,19 @@ static __be32 nfsd4_encode_pathname4(struct xdr_stream *xdr,
27302729
components[ncomponents++] = cur.dentry;
27312730
cur.dentry = dget_parent(cur.dentry);
27322731
}
2732+
27332733
err = nfserr_resource;
2734-
p = xdr_reserve_space(xdr, 4);
2735-
if (!p)
2734+
if (xdr_stream_encode_u32(xdr, ncomponents) != XDR_UNIT)
27362735
goto out_free;
2737-
*p++ = cpu_to_be32(ncomponents);
2738-
27392736
while (ncomponents) {
27402737
struct dentry *dentry = components[ncomponents - 1];
2741-
unsigned int len;
27422738

27432739
spin_lock(&dentry->d_lock);
2744-
len = dentry->d_name.len;
2745-
p = xdr_reserve_space(xdr, len + 4);
2746-
if (!p) {
2740+
if (xdr_stream_encode_opaque(xdr, dentry->d_name.name,
2741+
dentry->d_name.len) < 0) {
27472742
spin_unlock(&dentry->d_lock);
27482743
goto out_free;
27492744
}
2750-
p = xdr_encode_opaque(p, dentry->d_name.name, len);
27512745
dprintk("/%pd", dentry);
27522746
spin_unlock(&dentry->d_lock);
27532747
dput(dentry);

0 commit comments

Comments
 (0)