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  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:   Thu, 13 Apr 2017 23:27:38 +0000
From:   KY Srinivasan <kys@...rosoft.com>
To:     Miguel Bernal Marin <miguel.bernal.marin@...ux.intel.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        "James E.J. Bottomley" <jejb@...ux.vnet.ibm.com>
Subject: RE: [PATCH] scsi: storvsc: Prefer kcalloc over kzalloc with multiply



> -----Original Message-----
> From: Miguel Bernal Marin [mailto:miguel.bernal.marin@...ux.intel.com]
> Sent: Wednesday, March 15, 2017 11:58 PM
> To: KY Srinivasan <kys@...rosoft.com>; Martin K. Petersen
> <martin.petersen@...cle.com>
> Cc: linux-kernel@...r.kernel.org; linux-scsi@...r.kernel.org;
> devel@...uxdriverproject.org; Haiyang Zhang <haiyangz@...rosoft.com>;
> Stephen Hemminger <sthemmin@...rosoft.com>; James E.J. Bottomley
> <jejb@...ux.vnet.ibm.com>
> Subject: [PATCH] scsi: storvsc: Prefer kcalloc over kzalloc with multiply
> 
> Use kcalloc for allocating an array instead of kzalloc with multiply,
> kcalloc is the preferred API.
> 
> Found with checkpatch.
> 
> Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@...ux.intel.com>
Reviewed-by:  K. Y. Srinivasan <kys@...rosoft.com>


> ---
>  drivers/scsi/storvsc_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
> index 638e5f427c90..3d70d1cf49a3 100644
> --- a/drivers/scsi/storvsc_drv.c
> +++ b/drivers/scsi/storvsc_drv.c
> @@ -866,7 +866,7 @@ static int storvsc_channel_init(struct hv_device
> *device, bool is_fc)
>  	 * We will however populate all the slots to evenly distribute
>  	 * the load.
>  	 */
> -	stor_device->stor_chns = kzalloc(sizeof(void *) *
> num_possible_cpus(),
> +	stor_device->stor_chns = kcalloc(num_possible_cpus(), sizeof(void
> *),
>  					 GFP_KERNEL);
>  	if (stor_device->stor_chns == NULL)
>  		return -ENOMEM;
> --
> 2.12.0

Powered by blists - more mailing lists