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: <20250130075534.35847-1-a.vatoropin@crpt.ru>
Date: Thu, 30 Jan 2025 07:55:38 +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
get_mtt_entries() function, the mem->umem pointer cannot be NULL,
because it is pointer to struct.

Remove the extra NULL check. It is meaningless and harms the readability
of the code.
       
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Andrey Vatoropin <a.vatoropin@...t.ru>
---
 drivers/infiniband/hw/erdma/erdma_verbs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/erdma/erdma_verbs.c b/drivers/infiniband/hw/erdma/erdma_verbs.c
index 51d619edb6c5..fe4b79f15cf6 100644
--- a/drivers/infiniband/hw/erdma/erdma_verbs.c
+++ b/drivers/infiniband/hw/erdma/erdma_verbs.c
@@ -794,10 +794,8 @@ static int get_mtt_entries(struct erdma_dev *dev, struct erdma_mem *mem,
 	return 0;
 
 error_ret:
-	if (mem->umem) {
-		ib_umem_release(mem->umem);
-		mem->umem = NULL;
-	}
+	ib_umem_release(mem->umem);
+	mem->umem = NULL;
 
 	return ret;
 }
-- 
2.43.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ