]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
SUNRPC: remove BUG_ON in xdr_shrink_bufhead
authorWeston Andros Adamson <dros@netapp.com>
Tue, 23 Oct 2012 14:43:42 +0000 (10:43 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 4 Nov 2012 19:43:42 +0000 (14:43 -0500)
Replace bounds checking BUG_ON() with a WARN_ON_ONCE() and resetting
the requested len to the max.

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
net/sunrpc/xdr.c

index 08f50afd5f2a1d9dedc53ed1157d94be7e1e964d..56055632f1518323f68be9e8bcd3e59d7441be2c 100644 (file)
@@ -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) {