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: <20240824074033.2134514-3-lihongbo22@huawei.com>
Date: Sat, 24 Aug 2024 15:40:27 +0800
From: Hongbo Li <lihongbo22@...wei.com>
To: <johannes@...solutions.net>, <davem@...emloft.net>, <edumazet@...gle.com>,
	<kuba@...nel.org>, <pabeni@...hat.com>, <allison.henderson@...cle.com>,
	<dsahern@...nel.org>, <pshelar@....org>
CC: <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>, <lihongbo22@...wei.com>
Subject: [PATCH net-next 2/8] net/rds: Use max() to simplify the code

The target if-else can be replaced with max().

Signed-off-by: Hongbo Li <lihongbo22@...wei.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;
 	}
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ