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: <CAHp75VcFFfMp=nNDNyN3SNHnFXXXGGCobtKL2xaP+OqefmH5JQ@mail.gmail.com>
Date:   Sun, 31 Dec 2017 14:07:10 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Himanshu Jha <himanshujha199640@...il.com>
Cc:     Arend van Spriel <arend.vanspriel@...adcom.com>,
        Franky Lin <franky.lin@...adcom.com>,
        Hante Meuleman <hante.meuleman@...adcom.com>,
        Chi-Hsien Lin <chi-hsien.lin@...ress.com>,
        Wright Feng <wright.feng@...ress.com>,
        Kalle Valo <kvalo@...eaurora.org>,
        "open list:TI WILINK WIRELES..." <linux-wireless@...r.kernel.org>,
        "open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER" 
        <brcm80211-dev-list.pdl@...adcom.com>,
        brcm80211-dev-list@...ress.com, netdev <netdev@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "Luis R. Rodriguez" <mcgrof@...nel.org>
Subject: Re: [PATCH] brcmfmac: Use zeroing memory allocator than allocator/memset

On Sat, Dec 30, 2017 at 5:51 PM, Himanshu Jha
<himanshujha199640@...il.com> wrote:
> Use dma_zalloc_coherent for allocating zeroed
> memory and remove unnecessary memset function.
>
> Done using Coccinelle.
> Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> 0-day tested with no failures.
>

Makes sense.

Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

> Suggested-by: Luis R. Rodriguez <mcgrof@...nel.org>
> Signed-off-by: Himanshu Jha <himanshujha199640@...il.com>
> ---
>  .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c    | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> index 3c87157..bdef2ac 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> @@ -1251,14 +1251,13 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
>         u64 address;
>         u32 addr;
>
> -       devinfo->shared.scratch = dma_alloc_coherent(&devinfo->pdev->dev,
> -               BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
> -               &devinfo->shared.scratch_dmahandle, GFP_KERNEL);
> +       devinfo->shared.scratch =
> +               dma_zalloc_coherent(&devinfo->pdev->dev,
> +                                       BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
> +                                       &devinfo->shared.scratch_dmahandle,
> +                                       GFP_KERNEL);
>         if (!devinfo->shared.scratch)
>                 goto fail;
>
> -       memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
> -
>         addr = devinfo->shared.tcm_base_address +
>                BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET;
>         address = (u64)devinfo->shared.scratch_dmahandle;
> @@ -1268,14 +1267,13 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
>                BRCMF_SHARED_DMA_SCRATCH_LEN_OFFSET;
>         brcmf_pcie_write_tcm32(devinfo, addr, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
>
> -       devinfo->shared.ringupd = dma_alloc_coherent(&devinfo->pdev->dev,
> -               BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
> -               &devinfo->shared.ringupd_dmahandle, GFP_KERNEL);
> +       devinfo->shared.ringupd =
> +               dma_zalloc_coherent(&devinfo->pdev->dev,
> +                                       BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
> +                                       &devinfo->shared.ringupd_dmahandle,
> +                                       GFP_KERNEL);
>         if (!devinfo->shared.ringupd)
>                 goto fail;
>
> -       memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
> -
>         addr = devinfo->shared.tcm_base_address +
>                BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET;
>         address = (u64)devinfo->shared.ringupd_dmahandle;
> --
> 2.7.4
>



-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ