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-next>] [day] [month] [year] [list]
Message-Id: <20220512133754.40849-1-guozhengkui@vivo.com>
Date:   Thu, 12 May 2022 21:37:52 +0800
From:   Guo Zhengkui <guozhengkui@...o.com>
To:     "Martin K. Petersen" <martin.petersen@...cle.com>,
        Max Gurtovoy <mgurtovoy@...dia.com>,
        Mike Christie <michael.christie@...cle.com>,
        Varun Prakash <varun@...lsio.com>,
        Guo Zhengkui <guozhengkui@...o.com>,
        linux-scsi@...r.kernel.org (open list:SCSI TARGET SUBSYSTEM),
        target-devel@...r.kernel.org (open list:SCSI TARGET SUBSYSTEM),
        linux-kernel@...r.kernel.org (open list)
Cc:     zhengkui_guo@...look.com
Subject: [PATCH linux-next] scsi: target: cxgbit: replace ternary operator with min()

Fix the following coccicheck warnings:

drivers/target/iscsi/cxgbit/cxgbit_cm.c:1042:12-13: WARNING
opportunity for min()
drivers/target/iscsi/cxgbit/cxgbit_cm.c:1011:12-13: WARNING
opportunity for min()

min() macro is defined in include/linux/minmax.h. It avoids multiple
evaluations of the arguments when non-constant and performs strict
type-checking.

Signed-off-by: Guo Zhengkui <guozhengkui@...o.com>
---
 drivers/target/iscsi/cxgbit/cxgbit_cm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/target/iscsi/cxgbit/cxgbit_cm.c b/drivers/target/iscsi/cxgbit/cxgbit_cm.c
index 3336d2b78bf7..6d9a13da6cb7 100644
--- a/drivers/target/iscsi/cxgbit/cxgbit_cm.c
+++ b/drivers/target/iscsi/cxgbit/cxgbit_cm.c
@@ -1008,7 +1008,7 @@ int cxgbit_ofld_send(struct cxgbit_device *cdev, struct sk_buff *skb)
 	ret = cxgb4_ofld_send(cdev->lldi.ports[0], skb);
 	if (ret < 0)
 		kfree_skb(skb);
-	return ret < 0 ? ret : 0;
+	return min(ret, 0);
 }
 
 static void cxgbit_release_tid(struct cxgbit_device *cdev, u32 tid)
@@ -1039,7 +1039,7 @@ cxgbit_l2t_send(struct cxgbit_device *cdev, struct sk_buff *skb,
 	ret = cxgb4_l2t_send(cdev->lldi.ports[0], skb, l2e);
 	if (ret < 0)
 		kfree_skb(skb);
-	return ret < 0 ? ret : 0;
+	return min(ret, 0);
 }
 
 static void cxgbit_send_rx_credits(struct cxgbit_sock *csk, struct sk_buff *skb)
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ