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>] [day] [month] [year] [list]
Message-ID: <4b3795b5.6.1840fb613ac.Coremail.wangkailong@jari.cn>
Date:   Tue, 25 Oct 2022 23:15:01 +0800 (GMT+08:00)
From:   wangkailong@...i.cn
To:     Jason@...c4.com, djwong@...nel.org, hca@...ux.ibm.com,
        gregkh@...uxfoundation.org, kuba@...nel.org
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH] rslib: replace ternary operator with min()

Fix the following coccicheck warning:

lib/reed_solomon/test_rslib.c:422: WARNING opportunity for min()

Signed-off-by: KaiLong Wang <wangkailong@...i.cn>
---
 lib/reed_solomon/test_rslib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/reed_solomon/test_rslib.c b/lib/reed_solomon/test_rslib.c
index 848e7eb5da92..f4a03ae43b86 100644
--- a/lib/reed_solomon/test_rslib.c
+++ b/lib/reed_solomon/test_rslib.c
@@ -419,7 +419,7 @@ static int exercise_rs_bc(struct rs_control *rs, struct wspace *ws,
 		if (eras < 0)
 			eras = 0;
 
-		cutoff = nroots <= len - errs ? nroots : len - errs;
+		cutoff = min(nroots, len - errs);
 		for (; eras <= cutoff; eras++)
 			test_bc(rs, len, errs, eras, trials, &stat, ws);
 	}
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ