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: <20251127100523.6c6f79c6@pumpkin>
Date: Thu, 27 Nov 2025 10:05:23 +0000
From: David Laight <david.laight.linux@...il.com>
To: Sahil Chandna <chandna.sahil@...il.com>
Cc: akpm@...ux-foundation.org, david@...hat.com, lorenzo.stoakes@...cle.com,
 mhocko@...e.com, vbabka@...e.cz, rppt@...nel.org, surenb@...gle.com,
 hannes@...xchg.org, shakeel.butt@...ux.dev, zhengqi.arch@...edance.com,
 Liam.Howlett@...cle.com, weixugc@...gle.com, axelrasmussen@...gle.com,
 yuanchu@...gle.com, yosry.ahmed@...ux.dev, nphamcs@...il.com,
 chengming.zhou@...ux.dev, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
 david@...nel.org, Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v3 1/3] mm: pagewalk: simplify hugepage boundary
 calculation using min()

On Thu, 27 Nov 2025 10:41:28 +0530
Sahil Chandna <chandna.sahil@...il.com> wrote:

> Use the min() macro to compute the minimum value instead of an explicit 
> ternary expression. This improves readability and matches common kernel 
> style. Also change the return hugepage boundary expression for better
> clarity.
> 
>...
>  {
> -	unsigned long boundary = (addr & huge_page_mask(h)) + huge_page_size(h);
> -	return boundary < end ? boundary : end;
> +	return min(ALIGN(addr, huge_page_size(h)), end);
>  }
>  
>  static int walk_hugetlb_range(unsigned long addr, unsigned long end,

The commit message doesn't really match the patch.
The biggest part is not open-coding the equivalent of ALIGN(), not using min().

	David
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ