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]
Message-ID: <44BD95C9.8050600@cluded.net>
Date:	Wed, 19 Jul 2006 02:15:37 +0000
From:	"Daniel K." <daniel@...ded.net>
To:	Panagiotis Issaris <takis@...umba.uhasselt.be>
CC:	linux-kernel@...r.kernel.org, kyle@...isc-linux.org,
	twoller@...stal.cirrus.com, James@...erbug.demon.co.uk,
	zab@...bo.net, sailer@....ee.ethz.ch, perex@...e.cz,
	zaitcev@...oo.com
Subject: Re: [PATCH] sound: Conversions from kmalloc+memset to k(z|c)alloc.

Panagiotis Issaris wrote:
> diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c
> index eb5ea32..b257f20 100644
> --- a/sound/oss/swarm_cs4297a.c
> +++ b/sound/oss/swarm_cs4297a.c
> @@ -615,25 +615,23 @@ static int init_serdma(serdma_t *dma)
>  
>          /* Descriptors */
>          dma->ringsz = DMA_DESCR;
> -        dma->descrtab = kmalloc(dma->ringsz * sizeof(serdma_descr_t), GFP_KERNEL);
> +        dma->descrtab = kcalloc(dma->ringsz, sizeof(serdma_descr_t), GFP_KERNEL);
>          if (!dma->descrtab) {
>                  printk(KERN_ERR "cs4297a: kmalloc descrtab failed\n");

Maybe change the error message as well?

>                  return -1;
>          }
> -        memset(dma->descrtab, 0, dma->ringsz * sizeof(serdma_descr_t));
>          dma->descrtab_end = dma->descrtab + dma->ringsz;
>  	/* XXX bloddy mess, use proper DMA API here ...  */
>  	dma->descrtab_phys = CPHYSADDR((long)dma->descrtab);
>          dma->descr_add = dma->descr_rem = dma->descrtab;
>  
>          /* Frame buffer area */
> -        dma->dma_buf = kmalloc(DMA_BUF_SIZE, GFP_KERNEL);
> +        dma->dma_buf = kzalloc(DMA_BUF_SIZE, GFP_KERNEL);
>          if (!dma->dma_buf) {
>                  printk(KERN_ERR "cs4297a: kmalloc dma_buf failed\n");

here too

>                  kfree(dma->descrtab);
>                  return -1;
>          }
> -        memset(dma->dma_buf, 0, DMA_BUF_SIZE);
>          dma->dma_buf_phys = CPHYSADDR((long)dma->dma_buf);
>  
>          /* Samples buffer area */


Daniel K.

-
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