summaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorWeston Andros Adamson <dros@netapp.com>2012-10-23 10:43:41 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-11-04 14:43:41 -0500
commitb25cd058f25ea2054351bbe501956002cd8ed4c5 (patch)
tree85429bb1b4ef052235d981fcbb588a4afa5e3e93 /net/sunrpc
parentff1fdb9b805fc03fb51c7b061604360af92d0c9e (diff)
downloadlinux-stable-b25cd058f25ea2054351bbe501956002cd8ed4c5.tar.gz
linux-stable-b25cd058f25ea2054351bbe501956002cd8ed4c5.tar.bz2
linux-stable-b25cd058f25ea2054351bbe501956002cd8ed4c5.zip
SUNRPC: remove BUG_ONs checking RPCSVC_MAXPAGES
Replace two bounds checking BUG_ON() calls with WARN_ON_ONCE() and resetting the requested size to RPCSVC_MAXPAGES. Signed-off-by: Weston Andros Adamson <dros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/svc.c4
-rw-r--r--net/sunrpc/svc_xprt.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 664979bee1d2..3bf5a54982ba 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -587,7 +587,9 @@ svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node)
* We assume one is at most one page
*/
arghi = 0;
- BUG_ON(pages > RPCSVC_MAXPAGES);
+ WARN_ON_ONCE(pages > RPCSVC_MAXPAGES);
+ if (pages > RPCSVC_MAXPAGES)
+ pages = RPCSVC_MAXPAGES;
while (pages) {
struct page *p = alloc_pages_node(node, GFP_KERNEL, 0);
if (!p)
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index be89bb67f0ae..35fa74b09f77 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -579,7 +579,10 @@ int svc_alloc_arg(struct svc_rqst *rqstp)
/* now allocate needed pages. If we get a failure, sleep briefly */
pages = (serv->sv_max_mesg + PAGE_SIZE) / PAGE_SIZE;
- BUG_ON(pages >= RPCSVC_MAXPAGES);
+ WARN_ON_ONCE(pages >= RPCSVC_MAXPAGES);
+ if (pages >= RPCSVC_MAXPAGES)
+ /* use as many pages as possible */
+ pages = RPCSVC_MAXPAGES - 1;
for (i = 0; i < pages ; i++)
while (rqstp->rq_pages[i] == NULL) {
struct page *p = alloc_page(GFP_KERNEL);