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]
Message-ID: <8ebb412c-7978-5222-746e-1e35ff518275@huawei.com>
Date:   Thu, 8 Jul 2021 21:11:20 +0800
From:   Kemeng Shi <shikemeng@...wei.com>
To:     <dan.j.williams@...el.com>, <vishal.l.verma@...el.com>,
        <dave.jiang@...el.com>, <ira.weiny@...el.com>,
        <nvdimm@...ts.linux.dev>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] libnvdimm, badrange: replace div_u64_rem with
 DIV_ROUND_UP


A gentle ping

on 2021/6/26 11:53, Kemeng Shi wrote:
> __add_badblock_range use div_u64_rem to round up end_sector and it
> will introduces unnecessary rem define and costly '%' operation.
> So clean it with DIV_ROUND_UP.
> 
> Signed-off-by: Kemeng Shi <shikemeng@...wei.com>
> ---
> V1->V2:
> -- fix that end_sector is assigned twice, sorry for that.
> 
>  drivers/nvdimm/badrange.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/nvdimm/badrange.c b/drivers/nvdimm/badrange.c
> index aaf6e215a8c6..af622ae511aa 100644
> --- a/drivers/nvdimm/badrange.c
> +++ b/drivers/nvdimm/badrange.c
> @@ -187,12 +187,9 @@ static void __add_badblock_range(struct badblocks *bb, u64 ns_offset, u64 len)
>  	const unsigned int sector_size = 512;
>  	sector_t start_sector, end_sector;
>  	u64 num_sectors;
> -	u32 rem;
> 
>  	start_sector = div_u64(ns_offset, sector_size);
> -	end_sector = div_u64_rem(ns_offset + len, sector_size, &rem);
> -	if (rem)
> -		end_sector++;
> +	end_sector = DIV_ROUND_UP(ns_offset + len, sector_size);
>  	num_sectors = end_sector - start_sector;
> 
>  	if (unlikely(num_sectors > (u64)INT_MAX)) {
> 

-- 
Best wishes
Kemeng Shi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ