]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/infiniband/core/cma.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[net-next-2.6.git] / drivers / infiniband / core / cma.c
index ee946cc2576ba508667bcc0a8755e914f9b2129a..0751697ef984a87e7f688238a10760127fd7383f 100644 (file)
@@ -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)