Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

+5 -11
+5 -11
fs/nfsd/nfs4xdr.c
··· 2699 2699 const struct path *path) 2700 2700 { 2701 2701 struct path cur = *path; 2702 - __be32 *p; 2703 2702 struct dentry **components = NULL; 2704 2703 unsigned int ncomponents = 0; 2705 2704 __be32 err = nfserr_jukebox; ··· 2729 2730 components[ncomponents++] = cur.dentry; 2730 2731 cur.dentry = dget_parent(cur.dentry); 2731 2732 } 2732 - err = nfserr_resource; 2733 - p = xdr_reserve_space(xdr, 4); 2734 - if (!p) 2735 - goto out_free; 2736 - *p++ = cpu_to_be32(ncomponents); 2737 2733 2734 + err = nfserr_resource; 2735 + if (xdr_stream_encode_u32(xdr, ncomponents) != XDR_UNIT) 2736 + goto out_free; 2738 2737 while (ncomponents) { 2739 2738 struct dentry *dentry = components[ncomponents - 1]; 2740 - unsigned int len; 2741 2739 2742 2740 spin_lock(&dentry->d_lock); 2743 - len = dentry->d_name.len; 2744 - p = xdr_reserve_space(xdr, len + 4); 2745 - if (!p) { 2741 + if (xdr_stream_encode_opaque(xdr, dentry->d_name.name, 2742 + dentry->d_name.len) < 0) { 2746 2743 spin_unlock(&dentry->d_lock); 2747 2744 goto out_free; 2748 2745 } 2749 - p = xdr_encode_opaque(p, dentry->d_name.name, len); 2750 2746 dprintk("/%pd", dentry); 2751 2747 spin_unlock(&dentry->d_lock); 2752 2748 dput(dentry);