public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Corey Minyard <tcminyard@gmail.com>
To: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers: char: ipmi: Replaced kmalloc and strcpy with kstrdup
Date: Mon, 18 Mar 2013 08:19:38 -0500	[thread overview]
Message-ID: <5147146A.7040409@acm.org> (raw)
In-Reply-To: <1363443413-21937-1-git-send-email-gheorghiuandru@gmail.com>

On 03/16/2013 09:16 AM, Alexandru Gheorghiu wrote:
> Replaced calls to kmalloc followed by strcpy with a sincle call to kstrdup.
> Patch found using coccinelle.
>
> Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
> ---
>   drivers/char/ipmi/ipmi_msghandler.c |    3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
> index 053201b..617b443 100644
> --- a/drivers/char/ipmi/ipmi_msghandler.c
> +++ b/drivers/char/ipmi/ipmi_msghandler.c
> @@ -2037,12 +2037,11 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
>   	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
>   	if (!entry)
>   		return -ENOMEM;
> -	entry->name = kmalloc(strlen(name)+1, GFP_KERNEL);
> +	entry->name = kstrdup(name, GFP_KERNEL);
>   	if (!entry->name) {
>   		kfree(entry);
>   		return -ENOMEM;
>   	}
> -	strcpy(entry->name, name);
>   
>   	file = proc_create_data(name, 0, smi->proc_dir, proc_ops, data);
>   	if (!file) {
Looks good to me.

Acked-by: Corey Minyard <cminyard@mvista.com>

  reply	other threads:[~2013-03-18 13:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-16 14:16 [PATCH] drivers: char: ipmi: Replaced kmalloc and strcpy with kstrdup Alexandru Gheorghiu
2013-03-18 13:19 ` Corey Minyard [this message]
2013-03-18 13:59 ` Corey Minyard

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=5147146A.7040409@acm.org \
    --to=tcminyard@gmail.com \
    --cc=gheorghiuandru@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minyard@acm.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    /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