lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 18 Mar 2013 08:19:38 -0500
From:	Corey Minyard <tcminyard@...il.com>
To:	Alexandru Gheorghiu <gheorghiuandru@...il.com>
CC:	openipmi-developer@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers: char: ipmi: Replaced kmalloc and strcpy with
 kstrdup

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@...il.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@...sta.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ