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: <g5r32qh2tb3ttvnrsgs34jizaglwrbkvcw6q7lwpspawmgxdon@zb7mpeglnswj>
Date: Tue, 11 Mar 2025 10:29:57 -0400
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: linux-bcachefs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bcachefs: Use max() to improve gen_after()

On Tue, Mar 11, 2025 at 12:13:11PM +0100, Thorsten Blum wrote:
> Use max() to simplify gen_after() and improve its readability.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>

applied

> ---
>  fs/bcachefs/buckets.h | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/bcachefs/buckets.h b/fs/bcachefs/buckets.h
> index a9acdd6c0c86..124ac380b22e 100644
> --- a/fs/bcachefs/buckets.h
> +++ b/fs/bcachefs/buckets.h
> @@ -167,9 +167,7 @@ static inline int gen_cmp(u8 a, u8 b)
>  
>  static inline int gen_after(u8 a, u8 b)
>  {
> -	int r = gen_cmp(a, b);
> -
> -	return r > 0 ? r : 0;
> +	return max(0, gen_cmp(a, b));
>  }
>  
>  static inline int dev_ptr_stale_rcu(struct bch_dev *ca, const struct bch_extent_ptr *ptr)
> -- 
> 2.48.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ