aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/cma.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 93644f82592c..d08fb30768bc 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -2797,11 +2797,12 @@ static void cma_remove_one(struct ib_device *device)
2797 2797
2798static int cma_init(void) 2798static int cma_init(void)
2799{ 2799{
2800 int ret, low, high; 2800 int ret, low, high, remaining;
2801 2801
2802 get_random_bytes(&next_port, sizeof next_port); 2802 get_random_bytes(&next_port, sizeof next_port);
2803 inet_get_local_port_range(&low, &high); 2803 inet_get_local_port_range(&low, &high);
2804 next_port = ((unsigned int) next_port % (high - low)) + low; 2804 remaining = (high - low) + 1;
2805 next_port = ((unsigned int) next_port % remaining) + low;
2805 2806
2806 cma_wq = create_singlethread_workqueue("rdma_cm"); 2807 cma_wq = create_singlethread_workqueue("rdma_cm");
2807 if (!cma_wq) 2808 if (!cma_wq)