From: Eric Sesterhenn <snakebyte@gmx.de>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] [Patch] kmemdup() cleanup in drivers/infiniband
Date: Mon, 23 Oct 2006 20:17:21 +0000 [thread overview]
Message-ID: <1161634641.419.7.camel@alice> (raw)
In-Reply-To: <1161634468.419.1.camel@alice>
hi,
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>
--- linux-2.6.19-rc2-git7/drivers/infiniband/core/cm.c.orig 2006-10-23 21:07:38.000000000 +0200
+++ linux-2.6.19-rc2-git7/drivers/infiniband/core/cm.c 2006-10-23 21:08:07.000000000 +0200
@@ -240,11 +240,10 @@ static void * cm_copy_private_data(const
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;
}
--- linux-2.6.19-rc2-git7/drivers/infiniband/core/ucm.c.orig 2006-10-23 21:08:16.000000000 +0200
+++ linux-2.6.19-rc2-git7/drivers/infiniband/core/ucm.c 2006-10-23 21:08:58.000000000 +0200
@@ -328,20 +328,18 @@ static int ib_ucm_event_process(struct i
}
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;
--- linux-2.6.19-rc2-git7/drivers/infiniband/core/iwcm.c.orig 2006-10-23 21:09:11.000000000 +0200
+++ linux-2.6.19-rc2-git7/drivers/infiniband/core/iwcm.c 2006-10-23 21:09:32.000000000 +0200
@@ -140,10 +140,9 @@ static int copy_private_data(struct iwcm
{
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;
}
--- linux-2.6.19-rc2-git7/drivers/infiniband/hw/mthca/mthca_provider.c.orig 2006-10-23 21:09:57.000000000 +0200
+++ linux-2.6.19-rc2-git7/drivers/infiniband/hw/mthca/mthca_provider.c 2006-10-23 21:10:28.000000000 +0200
@@ -1100,11 +1100,10 @@ static struct ib_fmr *mthca_alloc_fmr(st
struct mthca_fmr *fmr;
int err;
- fmr = kmalloc(sizeof *fmr, GFP_KERNEL);
+ fmr = kmemdup(fmr_attr, sizeof *fmr, GFP_KERNEL);
if (!fmr)
return ERR_PTR(-ENOMEM);
- memcpy(&fmr->attr, fmr_attr, sizeof *fmr_attr);
err = mthca_fmr_alloc(to_mdev(pd->device), to_mpd(pd)->pd_num,
convert_access(mr_access_flags), fmr);
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2006-10-23 20:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-23 20:14 [KJ] [Patch] kmemdup() cleanup in drivers/acpi/ Eric Sesterhenn
2006-10-23 20:15 ` [KJ] [Patch] kmemdup() cleanup in drivers/base Eric Sesterhenn
2006-10-23 20:16 ` [KJ] [Patch] kmemdup() cleanup in drivers/ieee1394 Eric Sesterhenn
2006-10-23 20:17 ` Eric Sesterhenn [this message]
2006-10-23 20:18 ` [KJ] [Patch] kmemdup() cleanup in drivers/media/video Eric Sesterhenn
2006-10-23 20:19 ` [KJ] [Patch] kmemdup() cleanup in drivers/message Eric Sesterhenn
2006-10-23 20:20 ` [KJ] [Patch] kmemdup() cleanup in drivers/net Eric Sesterhenn
2006-10-23 20:21 ` [KJ] [Patch] kmemdup() cleanup in drivers/parport Eric Sesterhenn
2006-10-23 20:22 ` [KJ] [Patch] kmemdup() cleanup in drivers/pci/ Eric Sesterhenn
2006-10-23 20:42 ` [KJ] [Patch] kmemdup() cleanup in drivers/message Matthew Wilcox
2006-10-24 3:05 ` [KJ] [Patch] kmemdup() cleanup in drivers/infiniband Roland Dreier
2006-10-24 8:26 ` [KJ] [Patch] kmemdup() cleanup in drivers/pci/ Alexey Dobriyan
2006-10-24 14:53 ` Eric Sesterhenn / Snakebyte
2006-10-24 16:36 ` walter harms
2006-10-24 17:51 ` Alexey Dobriyan
2006-10-24 18:09 ` Matthew Wilcox
2006-10-26 19:04 ` [KJ] [Patch] kmemdup() cleanup in drivers/scsi Eric Sesterhenn
2006-10-26 19:07 ` [KJ] [Patch] kmemdup() cleanup in drivers/video/ Eric Sesterhenn
2006-10-29 19:00 ` [KJ] [Patch] kmemdup() cleanup in drivers/media/video Alexey Dobriyan
2006-10-29 19:02 ` [KJ] [Patch] kmemdup() cleanup in drivers/message Alexey Dobriyan
2006-11-06 8:13 ` [KJ] [Patch] kmemdup() cleanup in drivers/net Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1161634641.419.7.camel@alice \
--to=snakebyte@gmx.de \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).