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: <c01f55d7dc493f46cccd317666899a1272de607b.camel@oracle.com>
Date: Tue, 27 Aug 2024 05:28:22 +0000
From: Allison Henderson <allison.henderson@...cle.com>
To: "johannes@...solutions.net" <johannes@...solutions.net>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "lihongbo22@...wei.com"
	<lihongbo22@...wei.com>,
        "dsahern@...nel.org" <dsahern@...nel.org>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        "pshelar@....org"
	<pshelar@....org>
CC: "linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
        "rds-devel@....oracle.com" <rds-devel@....oracle.com>,
        "dccp@...r.kernel.org"
	<dccp@...r.kernel.org>,
        "linux-afs@...ts.infradead.org"
	<linux-afs@...ts.infradead.org>,
        "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>,
        "dev@...nvswitch.org" <dev@...nvswitch.org>
Subject: Re: [PATCH net-next 2/8] net/rds: Use max() to simplify the code

On Sat, 2024-08-24 at 15:40 +0800, Hongbo Li wrote:
> The target if-else can be replaced with max().
> 
> Signed-off-by: Hongbo Li <lihongbo22@...wei.com>

Looks simple enough to me.  Thanks Hongbo!

Reviewed-by: Allison Henderson <allison.henderson@...cle.com>

> ---
>  net/rds/info.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/net/rds/info.c b/net/rds/info.c
> index b6b46a8214a0..8558b0a466b4 100644
> --- a/net/rds/info.c
> +++ b/net/rds/info.c
> @@ -194,10 +194,7 @@ int rds_info_getsockopt(struct socket *sock, int
> optname, char __user *optval,
>         }
>         ret = pin_user_pages_fast(start, nr_pages, FOLL_WRITE,
> pages);
>         if (ret != nr_pages) {
> -               if (ret > 0)
> -                       nr_pages = ret;
> -               else
> -                       nr_pages = 0;
> +               nr_pages = max(ret, 0);
>                 ret = -EAGAIN; /* XXX ? */
>                 goto out;
>         }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ