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: <20250827121043.492620-1-liaoyuanhong@vivo.com>
Date: Wed, 27 Aug 2025 20:10:41 +0800
From: Liao Yuanhong <liaoyuanhong@...o.com>
To: Jeroen de Borst <jeroendb@...gle.com>,
	Harshitha Ramamurthy <hramamurthy@...gle.com>,
	Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Willem de Bruijn <willemb@...gle.com>,
	Joshua Washington <joshwash@...gle.com>,
	Praveen Kaligineedi <pkaligineedi@...gle.com>,
	netdev@...r.kernel.org (open list:GOOGLE ETHERNET DRIVERS),
	linux-kernel@...r.kernel.org (open list)
Cc: Liao Yuanhong <liaoyuanhong@...o.com>
Subject: [PATCH net-next] gve: remove redundant ternary operators

For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@...o.com>
---
 drivers/net/ethernet/google/gve/gve_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/google/gve/gve_tx.c b/drivers/net/ethernet/google/gve/gve_tx.c
index c6ff0968929d..a859a2308ae0 100644
--- a/drivers/net/ethernet/google/gve/gve_tx.c
+++ b/drivers/net/ethernet/google/gve/gve_tx.c
@@ -68,7 +68,7 @@ static int gve_tx_fifo_pad_alloc_one_frag(struct gve_tx_fifo *fifo,
 
 static bool gve_tx_fifo_can_alloc(struct gve_tx_fifo *fifo, size_t bytes)
 {
-	return (atomic_read(&fifo->available) <= bytes) ? false : true;
+	return atomic_read(&fifo->available) > bytes;
 }
 
 /* gve_tx_alloc_fifo - Allocate fragment(s) from Tx FIFO
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ