From: Leon Romanovsky <leon@kernel.org>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: yishaih@nvidia.com, dledford@redhat.com, jgg@ziepe.ca,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/mlx4: Remove unnessesary check in mlx4_ib_modify_wq()
Date: Sun, 9 May 2021 12:40:21 +0300 [thread overview]
Message-ID: <YJeuBYslGHMB84la@unreal> (raw)
In-Reply-To: <1620382961-69701-1-git-send-email-jiapeng.chong@linux.alibaba.com>
On Fri, May 07, 2021 at 06:22:41PM +0800, Jiapeng Chong wrote:
> cur_state and new_state are enums and when GCC considers
> them as unsigned, the conditions are never met.
>
> Clean up the following smatch warning:
>
> drivers/infiniband/hw/mlx4/qp.c:4258 mlx4_ib_modify_wq() warn: unsigned
> 'cur_state' is never less than zero.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> drivers/infiniband/hw/mlx4/qp.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
> index 92ddbcc..162aa59 100644
> --- a/drivers/infiniband/hw/mlx4/qp.c
> +++ b/drivers/infiniband/hw/mlx4/qp.c
> @@ -4255,8 +4255,7 @@ int mlx4_ib_modify_wq(struct ib_wq *ibwq, struct ib_wq_attr *wq_attr,
> ibwq->state;
> new_state = wq_attr_mask & IB_WQ_STATE ? wq_attr->wq_state : cur_state;
>
> - if (cur_state < IB_WQS_RESET || cur_state > IB_WQS_ERR ||
> - new_state < IB_WQS_RESET || new_state > IB_WQS_ERR)
> + if (cur_state > IB_WQS_ERR || new_state > IB_WQS_ERR)
> return -EINVAL;
Actually the more robust change will be to move this change to the ib_uverbs_ex_modify_wq().
Thanks
>
> if ((new_state == IB_WQS_RDY) && (cur_state == IB_WQS_ERR))
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2021-05-09 9:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-07 10:22 [PATCH] RDMA/mlx4: Remove unnessesary check in mlx4_ib_modify_wq() Jiapeng Chong
2021-05-09 8:58 ` Leon Romanovsky
2021-05-09 9:40 ` Leon Romanovsky [this message]
2021-05-11 17:43 ` Jason Gunthorpe
2021-05-18 7:05 ` Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YJeuBYslGHMB84la@unreal \
--to=leon@kernel.org \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=jiapeng.chong@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=yishaih@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).