diff mbox

Bug in xdr_copy_to_scratch???

Message ID 20110318101608.34bb1117@notabene.brown (mailing list archive)
State RFC, archived
Delegated to: Trond Myklebust
Headers show

Commit Message

NeilBrown March 17, 2011, 11:16 p.m. UTC
None
diff mbox

Patch

--- linux-2.6.37-openSUSE-11.4.orig/net/sunrpc/xdr.c
+++ linux-2.6.37-openSUSE-11.4/net/sunrpc/xdr.c
@@ -673,6 +673,11 @@  static __be32 *xdr_copy_to_scratch(struc
 	void *cpdest = xdr->scratch.iov_base;
 	size_t cplen = (char *)xdr->end - (char *)xdr->p;
 
+	/* some callers assume we return the full rounded-up
+	 * number of bytes.
+	 */
+	nbytes = XDR_QUADLEN(nbytes)*4;
+
 	if (nbytes > xdr->scratch.iov_len)
 		return NULL;
 	memcpy(cpdest, xdr->p, cplen);