From: Weston Andros Adamson Date: Tue, 23 Oct 2012 14:43:42 +0000 (-0400) Subject: SUNRPC: remove BUG_ON in xdr_shrink_bufhead X-Git-Tag: next-20121102~90^2~16 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=cf4b89fd4485a193d0f0abdedad9a5c7c95eed02;p=karo-tx-linux.git SUNRPC: remove BUG_ON in xdr_shrink_bufhead Replace bounds checking BUG_ON() with a WARN_ON_ONCE() and resetting the requested len to the max. Signed-off-by: Weston Andros Adamson Signed-off-by: Trond Myklebust --- diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index 08f50afd5f2a..56055632f151 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c @@ -318,7 +318,10 @@ xdr_shrink_bufhead(struct xdr_buf *buf, size_t len) tail = buf->tail; head = buf->head; - BUG_ON (len > head->iov_len); + + WARN_ON_ONCE(len > head->iov_len); + if (len > head->iov_len) + len = head->iov_len; /* Shift the tail first */ if (tail->iov_len != 0) {