Re: [bug report] RDMA/rxe: Rewrite rxe_task.c

Leon Romanovsky
2023-03-29T19:17:08Z

On Wed, Mar 29, 2023 at 02:09:17PM -0500, Bob Pearson wrote:
> On 3/29/23 01:48, Dan Carpenter wrote:
> > On Wed, Mar 29, 2023 at 09:27:26AM +0300, Dan Carpenter wrote:
> >> Hello Bob Pearson,
> >>
> >> The patch d94671632572: "RDMA/rxe: Rewrite rxe_task.c" from Mar 4,
> >> 2023, leads to the following Smatch static checker warning:
> >>
> >> drivers/infiniband/sw/rxe/rxe_task.c:24 __reserve_if_idle()
> >> warn: bitwise AND condition is false here
> >>
> >> drivers/infiniband/sw/rxe/rxe_task.c
> >> 20 static bool __reserve_if_idle(struct rxe_task *task)
> >> 21 {
> >> 22 WARN_ON(rxe_read(task->qp) <= 0);
> >> 23
> >> --> 24 if (task->tasklet.state & TASKLET_STATE_SCHED)
> >> ^^^^^^^^^^^^^^^^^^^
> >> This is zero. Should the check be == TASKLET_STATE_SCHED?
> >>
> >
> > The next function as well.
> >
> > drivers/infiniband/sw/rxe/rxe_task.c:49 __is_done() warn: bitwise AND condition is false here
> >
> > regards,
> > dan carpenter
> >
>
> Good catch. I was trying to open code the test in tasklet_schedule which was
> test_and_set_bit(TASKLET_STATE_SCHED, &t->state). I should have typed
>
> if (task->tasklet.state & (1 << TASKLET_STATE_BIT)) or similar.

What is wrong with test_bit(TASKLET_STATE_SCHED, &task->tasklet.state)?

Thanks

>
> Thanks,
>
> Bob