linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rdma-next] RDMA/rxe: Properly check tasklet state
@ 2023-03-29 18:18 Leon Romanovsky
  2023-03-29 19:15 ` Bob Pearson
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2023-03-29 18:18 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Leon Romanovsky, Bob Pearson, Dan Carpenter, linux-rdma, Zhu Yanjun

From: Leon Romanovsky <leonro@nvidia.com>

Fix the following smatch error:

  drivers/infiniband/sw/rxe/rxe_task.c:24 __reserve_if_idle()
  warn: bitwise AND condition is false here

Fixes: d94671632572 ("RDMA/rxe: Rewrite rxe_task.c")
Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/all/480b32b6-0f1c-4646-9ecc-e0760004cd24@kili.mountain
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/sw/rxe/rxe_task.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_task.c b/drivers/infiniband/sw/rxe/rxe_task.c
index fea9a517c8d9..48c89987137c 100644
--- a/drivers/infiniband/sw/rxe/rxe_task.c
+++ b/drivers/infiniband/sw/rxe/rxe_task.c
@@ -21,7 +21,7 @@ static bool __reserve_if_idle(struct rxe_task *task)
 {
 	WARN_ON(rxe_read(task->qp) <= 0);
 
-	if (task->tasklet.state & TASKLET_STATE_SCHED)
+	if (task->tasklet.state == TASKLET_STATE_SCHED)
 		return false;
 
 	if (task->state == TASK_STATE_IDLE) {
@@ -46,7 +46,7 @@ static bool __reserve_if_idle(struct rxe_task *task)
  */
 static bool __is_done(struct rxe_task *task)
 {
-	if (task->tasklet.state & TASKLET_STATE_SCHED)
+	if (task->tasklet.state == TASKLET_STATE_SCHED)
 		return false;
 
 	if (task->state == TASK_STATE_IDLE ||
-- 
2.39.2


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

* Re: [PATCH rdma-next] RDMA/rxe: Properly check tasklet state
  2023-03-29 18:18 [PATCH rdma-next] RDMA/rxe: Properly check tasklet state Leon Romanovsky
@ 2023-03-29 19:15 ` Bob Pearson
  2023-03-29 19:17   ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Bob Pearson @ 2023-03-29 19:15 UTC (permalink / raw)
  To: Leon Romanovsky, Jason Gunthorpe
  Cc: Leon Romanovsky, Dan Carpenter, linux-rdma, Zhu Yanjun

On 3/29/23 13:18, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
> 
> Fix the following smatch error:
> 
>   drivers/infiniband/sw/rxe/rxe_task.c:24 __reserve_if_idle()
>   warn: bitwise AND condition is false here
> 
> Fixes: d94671632572 ("RDMA/rxe: Rewrite rxe_task.c")
> Reported-by: Dan Carpenter <error27@gmail.com>
> Link: https://lore.kernel.org/all/480b32b6-0f1c-4646-9ecc-e0760004cd24@kili.mountain
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_task.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_task.c b/drivers/infiniband/sw/rxe/rxe_task.c
> index fea9a517c8d9..48c89987137c 100644
> --- a/drivers/infiniband/sw/rxe/rxe_task.c
> +++ b/drivers/infiniband/sw/rxe/rxe_task.c
> @@ -21,7 +21,7 @@ static bool __reserve_if_idle(struct rxe_task *task)
>  {
>  	WARN_ON(rxe_read(task->qp) <= 0);
>  
> -	if (task->tasklet.state & TASKLET_STATE_SCHED)
> +	if (task->tasklet.state == TASKLET_STATE_SCHED)
>  		return false;
>  
>  	if (task->state == TASK_STATE_IDLE) {
> @@ -46,7 +46,7 @@ static bool __reserve_if_idle(struct rxe_task *task)
>   */
>  static bool __is_done(struct rxe_task *task)
>  {
> -	if (task->tasklet.state & TASKLET_STATE_SCHED)
> +	if (task->tasklet.state == TASKLET_STATE_SCHED)
>  		return false;
>  
>  	if (task->state == TASK_STATE_IDLE ||

Leon, This is not correct either. I am about to fix this. -- Bob

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

* Re: [PATCH rdma-next] RDMA/rxe: Properly check tasklet state
  2023-03-29 19:15 ` Bob Pearson
@ 2023-03-29 19:17   ` Leon Romanovsky
  0 siblings, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2023-03-29 19:17 UTC (permalink / raw)
  To: Bob Pearson; +Cc: Jason Gunthorpe, Dan Carpenter, linux-rdma, Zhu Yanjun

On Wed, Mar 29, 2023 at 02:15:30PM -0500, Bob Pearson wrote:
> On 3/29/23 13:18, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@nvidia.com>
> > 
> > Fix the following smatch error:
> > 
> >   drivers/infiniband/sw/rxe/rxe_task.c:24 __reserve_if_idle()
> >   warn: bitwise AND condition is false here
> > 
> > Fixes: d94671632572 ("RDMA/rxe: Rewrite rxe_task.c")
> > Reported-by: Dan Carpenter <error27@gmail.com>
> > Link: https://lore.kernel.org/all/480b32b6-0f1c-4646-9ecc-e0760004cd24@kili.mountain
> > Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> > ---
> >  drivers/infiniband/sw/rxe/rxe_task.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/infiniband/sw/rxe/rxe_task.c b/drivers/infiniband/sw/rxe/rxe_task.c
> > index fea9a517c8d9..48c89987137c 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_task.c
> > +++ b/drivers/infiniband/sw/rxe/rxe_task.c
> > @@ -21,7 +21,7 @@ static bool __reserve_if_idle(struct rxe_task *task)
> >  {
> >  	WARN_ON(rxe_read(task->qp) <= 0);
> >  
> > -	if (task->tasklet.state & TASKLET_STATE_SCHED)
> > +	if (task->tasklet.state == TASKLET_STATE_SCHED)
> >  		return false;
> >  
> >  	if (task->state == TASK_STATE_IDLE) {
> > @@ -46,7 +46,7 @@ static bool __reserve_if_idle(struct rxe_task *task)
> >   */
> >  static bool __is_done(struct rxe_task *task)
> >  {
> > -	if (task->tasklet.state & TASKLET_STATE_SCHED)
> > +	if (task->tasklet.state == TASKLET_STATE_SCHED)
> >  		return false;
> >  
> >  	if (task->state == TASK_STATE_IDLE ||
> 
> Leon, This is not correct either. I am about to fix this. -- Bob

Sure, no problem.

Thanks

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

end of thread, other threads:[~2023-03-29 19:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 18:18 [PATCH rdma-next] RDMA/rxe: Properly check tasklet state Leon Romanovsky
2023-03-29 19:15 ` Bob Pearson
2023-03-29 19:17   ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).