X-Git-Url: https://nv-tegra.nvidia.com/r/gitweb?p=linux-3.10.git;a=blobdiff_plain;f=drivers%2Finfiniband%2Fcore%2Fcma.c;h=0751697ef984a87e7f688238a10760127fd7383f;hp=ee946cc2576ba508667bcc0a8755e914f9b2129a;hb=0b776eb5426752d4e53354ac89e3710d857e09a7;hpb=77109cc2823f025ccd66ebd9b88fbab90437b2d8 diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index ee946cc2576..0751697ef98 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -2803,11 +2803,12 @@ static void cma_remove_one(struct ib_device *device) static int cma_init(void) { - int ret, low, high; + int ret, low, high, remaining; get_random_bytes(&next_port, sizeof next_port); inet_get_local_port_range(&low, &high); - next_port = ((unsigned int) next_port % (high - low)) + low; + remaining = (high - low) + 1; + next_port = ((unsigned int) next_port % remaining) + low; cma_wq = create_singlethread_workqueue("rdma_cm"); if (!cma_wq)