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:   Thu, 18 Oct 2018 17:32:59 +0100
From:   John Garry <john.garry@...wei.com>
To:     Sabyasachi Gupta <sabyasachi.linux@...il.com>,
        <jejb@...ux.vnet.ibm.com>, <martin.petersen@...cle.com>,
        <keescook@...omium.org>, <jinpu.wang@...fitbricks.com>
CC:     <jrdr.linux@...il.com>, <linux-scsi@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <brajeswar.linux@...il.com>
Subject: Re: [PATCH] scsi/mvsas/mv_sas.c: Use dma_pool_zalloc

On 18/10/2018 17:06, Sabyasachi Gupta wrote:
> Replaced dma_pool_alloc + memset with dma_pool_zalloc
> Signed-off-by: Sabyasachi Gupta <sabyasachi.linux@...il.com>
> ---
>  drivers/scsi/mvsas/mv_sas.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
> index cff43bd..d00d37d 100644
> --- a/drivers/scsi/mvsas/mv_sas.c
> +++ b/drivers/scsi/mvsas/mv_sas.c
> @@ -790,12 +790,11 @@ static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf
>  	slot->n_elem = n_elem;
>  	slot->slot_tag = tag;
>
> -	slot->buf = dma_pool_alloc(mvi->dma_pool, GFP_ATOMIC, &slot->buf_dma);
> +	slot->buf = dma_pool_zalloc(mvi->dma_pool, GFP_ATOMIC, &slot->buf_dma);
>  	if (!slot->buf) {
>  		rc = -ENOMEM;
>  		goto err_out_tag;
>  	}
> -	memset(slot->buf, 0, MVS_SLOT_BUF_SZ);
>

How about also fixing these, below, up to use dma_zalloc_coherent() or 
even dmam_alloc_coherent() [as they're manually free'd at removal]:

static int mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost)
{
     int i = 0, slot_nr;
     char pool_name[32];
...
     /*
      * alloc and init our DMA areas
      */
     mvi->tx = dma_alloc_coherent(mvi->dev,
                      sizeof(*mvi->tx) * MVS_CHIP_SLOT_SZ,
                      &mvi->tx_dma, GFP_KERNEL);
     if (!mvi->tx)
         goto err_out;
     memset(mvi->tx, 0, sizeof(*mvi->tx) * MVS_CHIP_SLOT_SZ);

...

Thanks,
John

>  	tei.task = task;
>  	tei.hdr = &mvi->slot[tag];
>


Powered by blists - more mailing lists