2022-07-11 15:27:01

by Andrey Strachuk

[permalink] [raw]
Subject: [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 <[email protected]>
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


2022-07-11 16:28:21

by Bernard Metzler

[permalink] [raw]
Subject: RE: [PATCH] RDMA: remove useless condition in siw_create_cq()

> -----Original Message-----
> From: Andrey Strachuk <[email protected]>
> Sent: Monday, 11 July 2022 17:13
> To: Bernard Metzler <[email protected]>
> Cc: Andrey Strachuk <[email protected]>; Jason Gunthorpe <[email protected]>;
> Leon Romanovsky <[email protected]>; [email protected]; linux-
> [email protected]; [email protected]
> 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 <[email protected]>
> 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 <[email protected]>

Thanks Andrey!

2022-07-18 09:57:02

by Leon Romanovsky

[permalink] [raw]
Subject: Re: [PATCH] RDMA: remove useless condition in siw_create_cq()

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 <[email protected]>
> Fixes: 303ae1cdfdf7 ("rdma/siw: application interface")
> ---
> drivers/infiniband/sw/siw/siw_verbs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, applied.