public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA: remove useless condition in siw_create_cq()
@ 2022-07-11 15:12 Andrey Strachuk
  2022-07-18  9:11 ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Strachuk @ 2022-07-11 15:12 UTC (permalink / raw)
  To: Bernard Metzler
  Cc: Andrey Strachuk, Jason Gunthorpe, Leon Romanovsky, linux-rdma,
	linux-kernel, ldv-project

Comparison of 'cq' with NULL is useless since
'cq' is a result of container_of and cannot be NULL
in any reasonable scenario.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
Fixes: 303ae1cdfdf7 ("rdma/siw: application interface")
---
 drivers/infiniband/sw/siw/siw_verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
index 09316072b789..8dedae7ae79e 100644
--- a/drivers/infiniband/sw/siw/siw_verbs.c
+++ b/drivers/infiniband/sw/siw/siw_verbs.c
@@ -1167,7 +1167,7 @@ int siw_create_cq(struct ib_cq *base_cq, const struct ib_cq_init_attr *attr,
 err_out:
 	siw_dbg(base_cq->device, "CQ creation failed: %d", rv);
 
-	if (cq && cq->queue) {
+	if (cq->queue) {
 		struct siw_ucontext *ctx =
 			rdma_udata_to_drv_context(udata, struct siw_ucontext,
 						  base_ucontext);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] RDMA: remove useless condition in siw_create_cq()
@ 2022-07-11 16:21 Bernard Metzler
  0 siblings, 0 replies; 3+ messages in thread
From: Bernard Metzler @ 2022-07-11 16:21 UTC (permalink / raw)
  To: Andrey Strachuk
  Cc: Jason Gunthorpe, Leon Romanovsky, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org

> -----Original Message-----
> From: Andrey Strachuk <strochuk@ispras.ru>
> Sent: Monday, 11 July 2022 17:13
> To: Bernard Metzler <BMT@zurich.ibm.com>
> Cc: Andrey Strachuk <strochuk@ispras.ru>; Jason Gunthorpe <jgg@ziepe.ca>;
> Leon Romanovsky <leon@kernel.org>; linux-rdma@vger.kernel.org; linux-
> kernel@vger.kernel.org; ldv-project@linuxtesting.org
> Subject: [EXTERNAL] [PATCH] RDMA: remove useless condition in
> siw_create_cq()
> 
> Comparison of 'cq' with NULL is useless since
> 'cq' is a result of container_of and cannot be NULL
> in any reasonable scenario.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
> Fixes: 303ae1cdfdf7 ("rdma/siw: application interface")
> ---
>  drivers/infiniband/sw/siw/siw_verbs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/sw/siw/siw_verbs.c
> b/drivers/infiniband/sw/siw/siw_verbs.c
> index 09316072b789..8dedae7ae79e 100644
> --- a/drivers/infiniband/sw/siw/siw_verbs.c
> +++ b/drivers/infiniband/sw/siw/siw_verbs.c
> @@ -1167,7 +1167,7 @@ int siw_create_cq(struct ib_cq *base_cq, const struct
> ib_cq_init_attr *attr,
>  err_out:
>  	siw_dbg(base_cq->device, "CQ creation failed: %d", rv);
> 
> -	if (cq && cq->queue) {
> +	if (cq->queue) {
>  		struct siw_ucontext *ctx =
>  			rdma_udata_to_drv_context(udata, struct siw_ucontext,
>  						  base_ucontext);
> --
> 2.25.1

Acked-by: Bernard Metzler <bmt@zurich.ibm.com>

Thanks Andrey!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA: remove useless condition in siw_create_cq()
  2022-07-11 15:12 [PATCH] RDMA: remove useless condition in siw_create_cq() Andrey Strachuk
@ 2022-07-18  9:11 ` Leon Romanovsky
  0 siblings, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2022-07-18  9:11 UTC (permalink / raw)
  To: Andrey Strachuk
  Cc: Bernard Metzler, Jason Gunthorpe, linux-rdma, linux-kernel,
	ldv-project

On Mon, Jul 11, 2022 at 06:12:51PM +0300, Andrey Strachuk wrote:
> Comparison of 'cq' with NULL is useless since
> 'cq' is a result of container_of and cannot be NULL
> in any reasonable scenario.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
> Fixes: 303ae1cdfdf7 ("rdma/siw: application interface")
> ---
>  drivers/infiniband/sw/siw/siw_verbs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-18  9:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-11 15:12 [PATCH] RDMA: remove useless condition in siw_create_cq() Andrey Strachuk
2022-07-18  9:11 ` Leon Romanovsky
  -- strict thread matches above, loose matches on Subject: below --
2022-07-11 16:21 Bernard Metzler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox