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:   Tue, 2 Jan 2018 04:42:51 +0000
From:   "Rangankar, Manish" <Manish.Rangankar@...ium.com>
To:     Himanshu Jha <himanshujha199640@...il.com>,
        "jejb@...ux.vnet.ibm.com" <jejb@...ux.vnet.ibm.com>,
        "martin.petersen@...cle.com" <martin.petersen@...cle.com>,
        "aacraid@...ptec.com" <aacraid@...ptec.com>
CC:     "Gurumurthy, Anil" <Anil.Gurumurthy@...ium.com>,
        "Kalluru, Sudarsana" <Sudarsana.Kalluru@...ium.com>,
        Dept-Eng QLogic Storage Upstream 
        <QLogic-Storage-Upstream@...ium.com>,
        "satishkh@...co.com" <satishkh@...co.com>,
        "sebaddel@...co.com" <sebaddel@...co.com>,
        "kartilak@...co.com" <kartilak@...co.com>,
        Dept-Eng QLogic Storage Upstream 
        <QLogic-Storage-Upstream@...ium.com>,
        Dept-Eng QLA2xxx Upstream <qla2xxx-upstream@...ium.com>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 9/9] scsi: bnx2i: Use zeroing allocator rather than
 allocator/memset



On 30/12/17 8:58 PM, "Himanshu Jha" <himanshujha199640@...il.com> wrote:

>Use dma_zalloc_coherent instead of dma_alloc_coherent followed by
>memset 0.
>
>Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
>
>Suggested-by: Luis R. Rodriguez <mcgrof@...nel.org>
>Signed-off-by: Himanshu Jha <himanshujha199640@...il.com>
>---
> drivers/scsi/bnx2i/bnx2i_hwi.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
>diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c
>b/drivers/scsi/bnx2i/bnx2i_hwi.c
>index 9e3bf53..c6a0bd6 100644
>--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
>+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
>@@ -1069,16 +1069,15 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba,
>struct bnx2i_endpoint *ep)
> 	}
> 
> 	/* Allocate memory area for actual SQ element */
>-	ep->qp.sq_virt =
>-		dma_alloc_coherent(&hba->pcidev->dev, ep->qp.sq_mem_size,
>-				   &ep->qp.sq_phys, GFP_KERNEL);
>+	ep->qp.sq_virt =
>+		dma_zalloc_coherent(&hba->pcidev->dev, ep->qp.sq_mem_size,
>+					&ep->qp.sq_phys, GFP_KERNEL);
> 	if (!ep->qp.sq_virt) {
> 		printk(KERN_ALERT "bnx2i: unable to alloc SQ BD memory %d\n",
> 				  ep->qp.sq_mem_size);
> 		goto mem_alloc_err;
> 	}
> 
>-	memset(ep->qp.sq_virt, 0x00, ep->qp.sq_mem_size);
> 	ep->qp.sq_first_qe = ep->qp.sq_virt;
> 	ep->qp.sq_prod_qe = ep->qp.sq_first_qe;
> 	ep->qp.sq_cons_qe = ep->qp.sq_first_qe;
>@@ -1106,15 +1105,14 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba,
>struct bnx2i_endpoint *ep)
> 	}
> 
> 	/* Allocate memory area for actual CQ element */
>-	ep->qp.cq_virt =
>-		dma_alloc_coherent(&hba->pcidev->dev, ep->qp.cq_mem_size,
>-				   &ep->qp.cq_phys, GFP_KERNEL);
>+	ep->qp.cq_virt =
>+		dma_zalloc_coherent(&hba->pcidev->dev, ep->qp.cq_mem_size,
>+					&ep->qp.cq_phys, GFP_KERNEL);
> 	if (!ep->qp.cq_virt) {
> 		printk(KERN_ALERT "bnx2i: unable to alloc CQ BD memory %d\n",
> 				  ep->qp.cq_mem_size);
> 		goto mem_alloc_err;
> 	}
>-	memset(ep->qp.cq_virt, 0x00, ep->qp.cq_mem_size);
> 
> 	ep->qp.cq_first_qe = ep->qp.cq_virt;
> 	ep->qp.cq_prod_qe = ep->qp.cq_first_qe;
>-- 
>2.7.4

Acked-by: Manish Rangankar <Manish.Rangankar@...ium.com>


>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ