[lvc-project] [PATCH] RDMA/erdma: Drop redundant NULL check on error path
Ваторопин Андрей
a.vatoropin at crpt.ru
Thu Jan 30 11:04:24 MSK 2025
From: Andrey Vatoropin <a.vatoropin at crpt.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 at crpt.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
More information about the lvc-project
mailing list