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: <20191211111628.2955-1-max.hirsch@gmail.com>
Date:   Wed, 11 Dec 2019 11:16:26 +0000
From:   Max Hirsch <max.hirsch@...il.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     Max Hirsch <max.hirsch@...il.com>,
        Doug Ledford <dledford@...hat.com>,
        Jason Gunthorpe <jgg@...pe.ca>,
        Parav Pandit <parav@...lanox.com>,
        Leon Romanovsky <leon@...nel.org>,
        Steve Wise <swise@...ngridcomputing.com>,
        Bart Van Assche <bvanassche@....org>,
        Danit Goldberg <danitg@...lanox.com>,
        Matthew Wilcox <willy@...radead.org>,
        Dag Moxnes <dag.moxnes@...cle.com>,
        Myungho Jung <mhjungk@...il.com>, linux-rdma@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] RDMA/cma: Fix checkpatch error

When running checkpatch on cma.c the following error was found:

ERROR: do not use assignment in if condition
#413: FILE: drivers/infiniband/tmp.c:413:
+	if ((ret = (id_priv->state == comp)))

This patch moves the assignment of ret to the previous line. The if statement then checks the value of ret assigned on the previous line. The assigned value of ret is not changed. Testing involved recompiling and loading the kernel. After the changes checkpatch does not report this the error in cma.c.

Signed-off-by: Max Hirsch <max.hirsch@...il.com>
---
 drivers/infiniband/core/cma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 25f2b70fd8ef..bdb7a8493517 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -410,7 +410,8 @@ static int cma_comp_exch(struct rdma_id_private *id_priv,
 	int ret;
 
 	spin_lock_irqsave(&id_priv->lock, flags);
-	if ((ret = (id_priv->state == comp)))
+	ret = (id_priv->state == comp);
+	if (ret)
 		id_priv->state = exch;
 	spin_unlock_irqrestore(&id_priv->lock, flags);
 	return ret;
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ