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: <20250130080418.37915-1-a.vatoropin@crpt.ru>
Date: Thu, 30 Jan 2025 08:04:24 +0000
From: Ваторопин Андрей <a.vatoropin@...t.ru>
To: Cheng Xu <chengyou@...ux.alibaba.com>
CC: Ваторопин Андрей <a.vatoropin@...t.ru>, Kai Shen
	<kaishen@...ux.alibaba.com>, Jason Gunthorpe <jgg@...pe.ca>, Leon Romanovsky
	<leon@...nel.org>, "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"lvc-project@...uxtesting.org" <lvc-project@...uxtesting.org>
Subject: [PATCH] RDMA/erdma: Drop redundant NULL check on error path

From: Andrey Vatoropin <a.vatoropin@...t.ru>

Static analysis shows that on the error handling path in the
erdma_connect() function, the socket pointer cannot be NULL, since it is
pre-initialized in sock_create().  A potential failure in sock_create()
is processed.

Remove the extra NULL check. It is meaningless and harms the readability
of the code, since before that the socket pointer is unconditionally
dereferenced.

Found by Linux Verification Center (linuxtesting.org) with SVACE.
       
Signed-off-by: Andrey Vatoropin <a.vatoropin@...t.ru>
---
 drivers/infiniband/hw/erdma/erdma_cm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/erdma/erdma_cm.c b/drivers/infiniband/hw/erdma/erdma_cm.c
index 771059a8eb7d..2934081dfbd4 100644
--- a/drivers/infiniband/hw/erdma/erdma_cm.c
+++ b/drivers/infiniband/hw/erdma/erdma_cm.c
@@ -1116,8 +1116,7 @@ int erdma_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params)
 	erdma_cep_put(cep);
 
 error_release_sock:
-	if (s)
-		sock_release(s);
+	sock_release(s);
 error_put_qp:
 	erdma_qp_put(qp);
 
-- 
2.43.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ