Merge branches 'amso1100', 'bkl', 'cma', 'cxgb3', 'cxgb4', 'ipoib', 'iser', 'masked...
[sfrench/cifs-2.6.git] / drivers / infiniband / core / cma.c
index 6ae418e81d82f8c772b384c279712d3dbc602f2e..b930b8110a63b22f23822cc812740b0acf120988 100644 (file)
@@ -1676,13 +1676,13 @@ int rdma_set_ib_paths(struct rdma_cm_id *id,
        if (!cma_comp_exch(id_priv, CMA_ADDR_RESOLVED, CMA_ROUTE_RESOLVED))
                return -EINVAL;
 
-       id->route.path_rec = kmalloc(sizeof *path_rec * num_paths, GFP_KERNEL);
+       id->route.path_rec = kmemdup(path_rec, sizeof *path_rec * num_paths,
+                                    GFP_KERNEL);
        if (!id->route.path_rec) {
                ret = -ENOMEM;
                goto err;
        }
 
-       memcpy(id->route.path_rec, path_rec, sizeof *path_rec * num_paths);
        id->route.num_paths = num_paths;
        return 0;
 err: