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] [day] [month] [year] [list]
Date:   Thu, 29 Mar 2018 22:25:17 +0200
From:   Boris Brezillon <boris.brezillon@...tlin.com>
To:     Arushi Singhal <arushisinghal19971997@...il.com>
Cc:     dwmw2@...radead.org,
        Boris Brezillon <boris.brezillon@...e-electrons.com>,
        Richard Weinberger <richard@....at>,
        linux-kernel@...r.kernel.org, Marek Vasut <marek.vasut@...il.com>,
        linux-mtd@...ts.infradead.org,
        Cyrille Pitchen <cyrille.pitchen@...ev4u.fr>,
        Brian Norris <computersforpeace@...il.com>
Subject: Re: [PATCH] mtd: Use DIV_ROUND_UP()

On Sun, 25 Mar 2018 21:07:43 +0530
Arushi Singhal <arushisinghal19971997@...il.com> wrote:

> The kernel.h macro DIV_ROUND_UP performs the computation
> (((n) + (d) - 1) / (d)) but is perhaps more readable.
> 
> Signed-off-by: Arushi Singhal <arushisinghal19971997@...il.com>

Applied.

Thanks,

Boris

> ---
>  drivers/mtd/ftl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
> index a048429..61d5cf8 100644
> --- a/drivers/mtd/ftl.c
> +++ b/drivers/mtd/ftl.c
> @@ -425,8 +425,8 @@ static int prepare_xfer(partition_t *part, int i)
>      }
>  
>      /* Write the BAM stub */
> -    nbam = (part->BlocksPerUnit * sizeof(uint32_t) +
> -	    le32_to_cpu(part->header.BAMOffset) + SECTOR_SIZE - 1) / SECTOR_SIZE;
> +    nbam = DIV_ROUND_UP(part->BlocksPerUnit * sizeof(uint32_t) +
> +			le32_to_cpu(part->header.BAMOffset), SECTOR_SIZE);
>  
>      offset = xfer->Offset + le32_to_cpu(part->header.BAMOffset);
>      ctl = cpu_to_le32(BLOCK_CONTROL);



-- 
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ