* [PATCH] staging: brcm80211: use kstrdup()
@ 2011-08-06 9:17 Thomas Meyer
0 siblings, 0 replies; only message in thread
From: Thomas Meyer @ 2011-08-06 9:17 UTC (permalink / raw)
To: gregkh, Linux Kernel Mailing List
From: Thomas Meyer <thomas@m3y3r.de>
Use kstrdup rather than duplicating its implementation
The semantic patch that makes this output is available
in scripts/coccinelle/api/kstrdup.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
--- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c 2011-07-28 15:32:17.849920483 +0200
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c 2011-08-01 21:13:55.222431768 +0200
@@ -944,7 +944,7 @@ void brcmf_c_pktfilter_offload_set(struc
int i = 0;
char *arg_save = 0, *arg_org = 0;
- arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC);
+ arg_save = kstrdup(arg, GFP_ATOMIC);
if (!arg_save) {
BRCMF_ERROR(("%s: kmalloc failed\n", __func__));
goto fail;
@@ -958,8 +958,6 @@ void brcmf_c_pktfilter_offload_set(struc
goto fail;
}
- strcpy(arg_save, arg);
-
argv[i] = strsep(&arg_save, " ");
while (argv[i++])
argv[i] = strsep(&arg_save, " ");
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-08-06 9:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-06 9:17 [PATCH] staging: brcm80211: use kstrdup() Thomas Meyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox