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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 03 Nov 2017 16:44:17 -0500
From:   "Gustavo A. R. Silva" <garsilva@...eddedor.com>
To:     Han Xu <han.xu@....com>
Cc:     Boris Brezillon <boris.brezillon@...e-electrons.com>,
        Richard Weinberger <richard@....at>,
        David Woodhouse <dwmw2@...radead.org>,
        Brian Norris <computersforpeace@...il.com>,
        Marek Vasut <marek.vasut@...il.com>,
        Cyrille Pitchen <cyrille.pitchen@...ev4u.fr>,
        linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mtd: nand: gpmi: replace _manual_ swap with swap macro


Quoting Han Xu <han.xu@....com>:

> ________________________________________
> From: Gustavo A. R. Silva <garsilva@...eddedor.com>
> Sent: Friday, November 3, 2017 3:31 PM
> To: Han Xu; Boris Brezillon; Richard Weinberger; David Woodhouse;  
> Brian Norris; Marek Vasut; Cyrille Pitchen
> Cc: linux-mtd@...ts.infradead.org; linux-kernel@...r.kernel.org;  
> Gustavo A. R. Silva
> Subject: [PATCH] mtd: nand: gpmi: replace _manual_ swap with swap macro
>
> Make use of the swap macro and remove unnecessary variables swap.
> This makes the code easier to read and maintain.
>
> This code was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva <garsilva@...eddedor.com>
> ---
>  drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c  
> b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> index 50f8d4a..9e365d4 100644
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> @@ -1487,12 +1487,8 @@ static int gpmi_ecc_read_page_raw(struct  
> mtd_info *mtd,
>          * See the layout description for a detailed explanation on why this
>          * is needed.
>          */
> -       if (this->swap_block_mark) {
> -               u8 swap = tmp_buf[0];
> -
> -               tmp_buf[0] = tmp_buf[mtd->writesize];
> -               tmp_buf[mtd->writesize] = swap;
> -       }
> +       if (this->swap_block_mark)
> +               swap(tmp_buf[0], tmp_buf[mtd->writesize]);
>
>         /*
>          * Copy the metadata section into the oob buffer (this section is
> @@ -1615,12 +1611,8 @@ static int gpmi_ecc_write_page_raw(struct  
> mtd_info *mtd,
>          * See the layout description for a detailed explanation on why this
>          * is needed.
>          */
> -       if (this->swap_block_mark) {
> -               u8 swap = tmp_buf[0];
> -
> -               tmp_buf[0] = tmp_buf[mtd->writesize];
> -               tmp_buf[mtd->writesize] = swap;
> -       }
> +       if (this->swap_block_mark)
> +               swap(tmp_buf[0], tmp_buf[mtd->writesize]);
>
>         chip->write_buf(mtd, tmp_buf, mtd->writesize + mtd->oobsize);
>
> Acked-by: Han Xu <han.xu@....com>
>

Thank you, Han.
--
Gustavo A. R. Silva






Powered by blists - more mailing lists