diff options
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/svc.c | 4 | ||||
-rw-r--r-- | net/sunrpc/svc_xprt.c | 5 |
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) | |||
587 | * We assume one is at most one page | 587 | * We assume one is at most one page |
588 | */ | 588 | */ |
589 | arghi = 0; | 589 | arghi = 0; |
590 | BUG_ON(pages > RPCSVC_MAXPAGES); | 590 | WARN_ON_ONCE(pages > RPCSVC_MAXPAGES); |
591 | if (pages > RPCSVC_MAXPAGES) | ||
592 | pages = RPCSVC_MAXPAGES; | ||
591 | while (pages) { | 593 | while (pages) { |
592 | struct page *p = alloc_pages_node(node, GFP_KERNEL, 0); | 594 | struct page *p = alloc_pages_node(node, GFP_KERNEL, 0); |
593 | if (!p) | 595 | 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) | |||
579 | 579 | ||
580 | /* now allocate needed pages. If we get a failure, sleep briefly */ | 580 | /* now allocate needed pages. If we get a failure, sleep briefly */ |
581 | pages = (serv->sv_max_mesg + PAGE_SIZE) / PAGE_SIZE; | 581 | pages = (serv->sv_max_mesg + PAGE_SIZE) / PAGE_SIZE; |
582 | BUG_ON(pages >= RPCSVC_MAXPAGES); | 582 | WARN_ON_ONCE(pages >= RPCSVC_MAXPAGES); |
583 | if (pages >= RPCSVC_MAXPAGES) | ||
584 | /* use as many pages as possible */ | ||
585 | pages = RPCSVC_MAXPAGES - 1; | ||
583 | for (i = 0; i < pages ; i++) | 586 | for (i = 0; i < pages ; i++) |
584 | while (rqstp->rq_pages[i] == NULL) { | 587 | while (rqstp->rq_pages[i] == NULL) { |
585 | struct page *p = alloc_page(GFP_KERNEL); | 588 | struct page *p = alloc_page(GFP_KERNEL); |