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] [day] [month] [year] [list]
Date:	Fri, 24 Aug 2012 09:30:12 -0700
From:	adam radford <aradford@...il.com>
To:	Fengguang Wu <fengguang.wu@...el.com>
Cc:	James Bottomley <James.Bottomley@...senpartnership.com>,
	Neela Syam Kolli <megaraidlinux@....com>,
	linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] megaraid_sas: combine kmalloc+memset into kzalloc

On Fri, Aug 24, 2012 at 8:27 AM, Fengguang Wu <fengguang.wu@...el.com> wrote:
> Use kzalloc rather than kmalloc followed by memset with 0.
>
> Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
>
> Signed-off-by: Fengguang Wu <fengguang.wu@...el.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> --- linux.orig/drivers/scsi/megaraid/megaraid_sas_fusion.c      2012-06-07 05:39:57.418846382 +0800
> +++ linux/drivers/scsi/megaraid/megaraid_sas_fusion.c   2012-08-24 23:25:02.261560445 +0800
> @@ -461,8 +461,8 @@ megasas_alloc_cmds_fusion(struct megasas
>          * Allocate the dynamic array first and then allocate individual
>          * commands.
>          */
> -       fusion->cmd_list = kmalloc(sizeof(struct megasas_cmd_fusion *)
> -                                  *max_cmd, GFP_KERNEL);
> +       fusion->cmd_list = kzalloc(sizeof(struct megasas_cmd_fusion *)
> +                                  * max_cmd, GFP_KERNEL);
>
>         if (!fusion->cmd_list) {
>                 printk(KERN_DEBUG "megasas: out of memory. Could not alloc "
> @@ -470,9 +470,6 @@ megasas_alloc_cmds_fusion(struct megasas
>                 goto fail_cmd_list;
>         }
>
> -       memset(fusion->cmd_list, 0, sizeof(struct megasas_cmd_fusion *)
> -              *max_cmd);
> -
>         max_cmd = instance->max_fw_cmds;
>         for (i = 0; i < max_cmd; i++) {
>                 fusion->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd_fusion),

Acked-by: Adam Radford <aradford@...il.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