From: Takashi Iwai <tiwai@suse.de>
To: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sound: oss: sb_common: Used kmemdup instead of kmalloc and memcpy
Date: Tue, 02 Apr 2013 11:23:36 +0200 [thread overview]
Message-ID: <s5hli918ew7.wl%tiwai@suse.de> (raw)
In-Reply-To: <1364219434-11920-1-git-send-email-gheorghiuandru@gmail.com>
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
>
prev parent reply other threads:[~2013-04-02 9:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-25 13:50 Alexandru Gheorghiu
2013-04-02 9:23 ` Takashi Iwai [this message]
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=s5hli918ew7.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=gheorghiuandru@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
/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
all inboxes | Powered by JetHome®