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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240828135903.GD1368797@kernel.org>
Date: Wed, 28 Aug 2024 14:59:03 +0100
From: Simon Horman <horms@...nel.org>
To: Hongbo Li <lihongbo22@...wei.com>
Cc: johannes@...solutions.net, davem@...emloft.net, edumazet@...gle.com,
	kuba@...nel.org, pabeni@...hat.com, allison.henderson@...cle.com,
	dsahern@...nel.org, pshelar@....org, linux-wireless@...r.kernel.org,
	netdev@...r.kernel.org, rds-devel@....oracle.com,
	dccp@...r.kernel.org, dev@...nvswitch.org,
	linux-afs@...ts.infradead.org
Subject: Re: [PATCH net-next 4/8] net/core: Use min()/max() to simplify the
 code

On Sat, Aug 24, 2024 at 03:40:29PM +0800, Hongbo Li wrote:
> Let's use min()/max() to simplify the code and fix the
> Coccinelle/coccicheck warning.
> 
> Signed-off-by: Hongbo Li <lihongbo22@...wei.com>

...

> diff --git a/net/core/sock.c b/net/core/sock.c
> index bbe4c58470c3..c9910f48903f 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -3800,7 +3800,7 @@ int sock_prot_inuse_get(struct net *net, struct proto *prot)
>  	for_each_possible_cpu(cpu)
>  		res += per_cpu_ptr(net->core.prot_inuse, cpu)->val[idx];
>  
> -	return res >= 0 ? res : 0;
> +	return max(res, 0);
>  }
>  EXPORT_SYMBOL_GPL(sock_prot_inuse_get);

As per my comment on 2/8 [*], I think you should drop this hunk.

[*] https://lore.kernel.org/all/20240828135310.GC1368797@kernel.org/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ