summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core
diff options
context:
space:
mode:
authorEric Sesterhenn <snakebyte@gmx.de>2006-10-23 22:17:21 +0200
committerRoland Dreier <rolandd@cisco.com>2006-11-30 00:33:06 +0100
commitbed8bdfddd851657cf9e5fd16bb44abb02ae7f42 (patch)
treeac021f613071dc4a274d071ea900709cd4e17374 /drivers/infiniband/core
parentRDMA/cma: Rewrite cma_req_handler() to encapsulate common code (diff)
downloadlinux-bed8bdfddd851657cf9e5fd16bb44abb02ae7f42.tar.xz
linux-bed8bdfddd851657cf9e5fd16bb44abb02ae7f42.zip
IB: kmemdup() cleanup
Replace open coded kmemdup() to save some screen space, and allow inlining/not inlining to be triggered by gcc. Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r--drivers/infiniband/core/cm.c3
-rw-r--r--drivers/infiniband/core/iwcm.c3
-rw-r--r--drivers/infiniband/core/ucm.c6
3 files changed, 4 insertions, 8 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 25b1018a476c..82bc83baceaf 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -240,11 +240,10 @@ static void * cm_copy_private_data(const void *private_data,
if (!private_data || !private_data_len)
return NULL;
- data = kmalloc(private_data_len, GFP_KERNEL);
+ data = kmemdup(private_data, private_data_len, GFP_KERNEL);
if (!data)
return ERR_PTR(-ENOMEM);
- memcpy(data, private_data, private_data_len);
return data;
}
diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
index c3fb304a4e86..2bbcfa5c6e27 100644
--- a/drivers/infiniband/core/iwcm.c
+++ b/drivers/infiniband/core/iwcm.c
@@ -140,10 +140,9 @@ static int copy_private_data(struct iwcm_id_private *cm_id_priv,
{
void *p;
- p = kmalloc(event->private_data_len, GFP_ATOMIC);
+ p = kmemdup(event->private_data, event->private_data_len, GFP_ATOMIC);
if (!p)
return -ENOMEM;
- memcpy(p, event->private_data, event->private_data_len);
event->private_data = p;
return 0;
}
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index ad4f4d5c2924..b4894ba223b7 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -328,20 +328,18 @@ static int ib_ucm_event_process(struct ib_cm_event *evt,
}
if (uvt->data_len) {
- uvt->data = kmalloc(uvt->data_len, GFP_KERNEL);
+ uvt->data = kmemdup(evt->private_data, uvt->data_len, GFP_KERNEL);
if (!uvt->data)
goto err1;
- memcpy(uvt->data, evt->private_data, uvt->data_len);
uvt->resp.present |= IB_UCM_PRES_DATA;
}
if (uvt->info_len) {
- uvt->info = kmalloc(uvt->info_len, GFP_KERNEL);
+ uvt->info = kmemdup(info, uvt->info_len, GFP_KERNEL);
if (!uvt->info)
goto err2;
- memcpy(uvt->info, info, uvt->info_len);
uvt->resp.present |= IB_UCM_PRES_INFO;
}
return 0;