* [PATCH] sound: oss: sb_common: Used kmemdup instead of kmalloc and memcpy
@ 2013-03-25 13:50 Alexandru Gheorghiu
2013-04-02 9:23 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Alexandru Gheorghiu @ 2013-03-25 13:50 UTC (permalink / raw)
To: Jaroslav Kysela
Cc: Takashi Iwai, alsa-devel, linux-kernel, Alexandru Gheorghiu
Used kmemdup instead of replicating it's behaviour with kmalloc followed
by memcpy.
Patch found using coccinelle.
Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
---
sound/oss/sb_common.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/oss/sb_common.c b/sound/oss/sb_common.c
index 7d42c54..851a1da 100644
--- a/sound/oss/sb_common.c
+++ b/sound/oss/sb_common.c
@@ -626,13 +626,12 @@ int sb_dsp_detect(struct address_info *hw_config, int pci, int pciio, struct sb_
*/
- detected_devc = kmalloc(sizeof(sb_devc), GFP_KERNEL);
+ detected_devc = kmemdup(devc, sizeof(sb_devc), GFP_KERNEL);
if (detected_devc == NULL)
{
printk(KERN_ERR "sb: Can't allocate memory for device information\n");
return 0;
}
- memcpy(detected_devc, devc, sizeof(sb_devc));
MDB(printk(KERN_INFO "SB %d.%02d detected OK (%x)\n", devc->major, devc->minor, hw_config->io_base));
return 1;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sound: oss: sb_common: Used kmemdup instead of kmalloc and memcpy
2013-03-25 13:50 [PATCH] sound: oss: sb_common: Used kmemdup instead of kmalloc and memcpy Alexandru Gheorghiu
@ 2013-04-02 9:23 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2013-04-02 9:23 UTC (permalink / raw)
To: Alexandru Gheorghiu; +Cc: Jaroslav Kysela, alsa-devel, linux-kernel
At Mon, 25 Mar 2013 15:50:34 +0200,
Alexandru Gheorghiu wrote:
>
> Used kmemdup instead of replicating it's behaviour with kmalloc followed
> by memcpy.
> Patch found using coccinelle.
>
> Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
Thanks, applied.
Takashi
> ---
> sound/oss/sb_common.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/sound/oss/sb_common.c b/sound/oss/sb_common.c
> index 7d42c54..851a1da 100644
> --- a/sound/oss/sb_common.c
> +++ b/sound/oss/sb_common.c
> @@ -626,13 +626,12 @@ int sb_dsp_detect(struct address_info *hw_config, int pci, int pciio, struct sb_
> */
>
>
> - detected_devc = kmalloc(sizeof(sb_devc), GFP_KERNEL);
> + detected_devc = kmemdup(devc, sizeof(sb_devc), GFP_KERNEL);
> if (detected_devc == NULL)
> {
> printk(KERN_ERR "sb: Can't allocate memory for device information\n");
> return 0;
> }
> - memcpy(detected_devc, devc, sizeof(sb_devc));
> MDB(printk(KERN_INFO "SB %d.%02d detected OK (%x)\n", devc->major, devc->minor, hw_config->io_base));
> return 1;
> }
> --
> 1.7.9.5
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-02 9:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-25 13:50 [PATCH] sound: oss: sb_common: Used kmemdup instead of kmalloc and memcpy Alexandru Gheorghiu
2013-04-02 9:23 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.