diff options
| -rw-r--r-- | net/rds/rdma.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/rds/rdma.c b/net/rds/rdma.c index 1a41debca1ce..0df02c8a8533 100644 --- a/net/rds/rdma.c +++ b/net/rds/rdma.c | |||
| @@ -502,6 +502,13 @@ static int rds_rdma_pages(struct rds_rdma_args *args) | |||
| 502 | return -EINVAL; | 502 | return -EINVAL; |
| 503 | 503 | ||
| 504 | tot_pages += nr_pages; | 504 | tot_pages += nr_pages; |
| 505 | |||
| 506 | /* | ||
| 507 | * nr_pages for one entry is limited to (UINT_MAX>>PAGE_SHIFT)+1, | ||
| 508 | * so tot_pages cannot overflow without first going negative. | ||
| 509 | */ | ||
| 510 | if ((int)tot_pages < 0) | ||
| 511 | return -EINVAL; | ||
| 505 | } | 512 | } |
| 506 | 513 | ||
| 507 | return tot_pages; | 514 | return tot_pages; |
