public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] IB/hns: Fix the bug of polling cq failed for loopback Qps
@ 2017-07-19 11:48 Dan Carpenter
  2017-07-20 11:41 ` oulijun
  2017-07-25  1:21 ` Wei Hu (Xavier)
  0 siblings, 2 replies; 7+ messages in thread
From: Dan Carpenter @ 2017-07-19 11:48 UTC (permalink / raw)
  To: oulijun-hv44wF8Li93QT0dZR+AlfA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Hello oulijun,

This is a semi-automatic email about new static checker warnings.

The patch 5802883d4b7c: "IB/hns: Fix the bug of polling cq failed for
loopback Qps" from Jun 10, 2017, leads to the following Smatch
complaint:

    drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1009 hns_roce_v1_mr_free_work_fn()
    error: we previously assumed 'hr_qp' could be null (see line 991)

drivers/infiniband/hw/hns/hns_roce_hw_v1.c
   989          for (i = 0; i < HNS_ROCE_V1_RESV_QP; i++) {
   990			hr_qp = free_mr->mr_free_qp[i];
   991			if (!hr_qp)
                             ^^^^^
New check for NULL.  Assume it happens on the last iteration through the
loop.

   992				continue;
   993			ne++;
   994	
   995			ret = hns_roce_v1_send_lp_wqe(hr_qp);
   996			if (ret) {
   997				dev_err(dev,
   998				     "Send wqe (qp:0x%lx) for mr free failed(%d)!\n",
   999				     hr_qp->qpn, ret);
  1000				goto free_work;
  1001			}
  1002		}
  1003	
  1004		do {
  1005			ret = hns_roce_v1_poll_cq(&mr_free_cq->ib_cq, ne, wc);
  1006			if (ret < 0) {
  1007				dev_err(dev,
  1008				   "(qp:0x%lx) starts, Poll cqe failed(%d) for mr 0x%x free! Remain %d cqe\n",
  1009				   hr_qp->qpn, ret, hr_mr->key, ne);
                                   ^^^^^^^^^^
Unchecked dereference.

  1010				goto free_work;
  1011			}

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [bug report] IB/hns: Fix the bug of polling cq failed for loopback Qps
  2017-07-19 11:48 [bug report] IB/hns: Fix the bug of polling cq failed for loopback Qps Dan Carpenter
@ 2017-07-20 11:41 ` oulijun
  2017-07-25  1:21 ` Wei Hu (Xavier)
  1 sibling, 0 replies; 7+ messages in thread
From: oulijun @ 2017-07-20 11:41 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, huwei, Xushaobo (Elliott),
	Chenxin (Charles), weihaifeng, liudongdong

在 2017/7/19 19:48, Dan Carpenter 写道:
> Hello oulijun,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 5802883d4b7c: "IB/hns: Fix the bug of polling cq failed for
> loopback Qps" from Jun 10, 2017, leads to the following Smatch
> complaint:
>
>     drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1009 hns_roce_v1_mr_free_work_fn()
>     error: we previously assumed 'hr_qp' could be null (see line 991)
>
> drivers/infiniband/hw/hns/hns_roce_hw_v1.c
>    989          for (i = 0; i < HNS_ROCE_V1_RESV_QP; i++) {
>    990			hr_qp = free_mr->mr_free_qp[i];
>    991			if (!hr_qp)
>                              ^^^^^
> New check for NULL.  Assume it happens on the last iteration through the
> loop.
Hi, Dan
    Thank you for reporting.
   It may be a question. I will check it and send a ptch to fix it at soon.

Thanks
Lijun Ou
>    992				continue;
>    993			ne++;
>    994	
>    995			ret = hns_roce_v1_send_lp_wqe(hr_qp);
>    996			if (ret) {
>    997				dev_err(dev,
>    998				     "Send wqe (qp:0x%lx) for mr free failed(%d)!\n",
>    999				     hr_qp->qpn, ret);
>   1000				goto free_work;
>   1001			}
>   1002		}
>   1003	
>   1004		do {
>   1005			ret = hns_roce_v1_poll_cq(&mr_free_cq->ib_cq, ne, wc);
>   1006			if (ret < 0) {
>   1007				dev_err(dev,
>   1008				   "(qp:0x%lx) starts, Poll cqe failed(%d) for mr 0x%x free! Remain %d cqe\n",
>   1009				   hr_qp->qpn, ret, hr_mr->key, ne);
>                                    ^^^^^^^^^^
> Unchecked dereference.
>
>   1010				goto free_work;
>   1011			}
>
> regards,
> dan carpenter
>
> .
>


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [bug report] IB/hns: Fix the bug of polling cq failed for loopback Qps
  2017-07-19 11:48 [bug report] IB/hns: Fix the bug of polling cq failed for loopback Qps Dan Carpenter
  2017-07-20 11:41 ` oulijun
@ 2017-07-25  1:21 ` Wei Hu (Xavier)
       [not found]   ` <59769D18.4020400-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Wei Hu (Xavier) @ 2017-07-25  1:21 UTC (permalink / raw)
  To: Dan Carpenter, oulijun-hv44wF8Li93QT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Hi Dan Carpenter

     Thanks for your comments.
     What is the checker tool? Where can I get it?
     Thanks.

     Regards
Wei Hu

On 2017/7/19 19:48, Dan Carpenter wrote:
> Hello oulijun,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 5802883d4b7c: "IB/hns: Fix the bug of polling cq failed for
> loopback Qps" from Jun 10, 2017, leads to the following Smatch
> complaint:
>
>      drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1009 hns_roce_v1_mr_free_work_fn()
>      error: we previously assumed 'hr_qp' could be null (see line 991)
>
> drivers/infiniband/hw/hns/hns_roce_hw_v1.c
>     989          for (i = 0; i < HNS_ROCE_V1_RESV_QP; i++) {
>     990			hr_qp = free_mr->mr_free_qp[i];
>     991			if (!hr_qp)
>                               ^^^^^
> New check for NULL.  Assume it happens on the last iteration through the
> loop.
>
>     992				continue;
>     993			ne++;
>     994	
>     995			ret = hns_roce_v1_send_lp_wqe(hr_qp);
>     996			if (ret) {
>     997				dev_err(dev,
>     998				     "Send wqe (qp:0x%lx) for mr free failed(%d)!\n",
>     999				     hr_qp->qpn, ret);
>    1000				goto free_work;
>    1001			}
>    1002		}
>    1003	
>    1004		do {
>    1005			ret = hns_roce_v1_poll_cq(&mr_free_cq->ib_cq, ne, wc);
>    1006			if (ret < 0) {
>    1007				dev_err(dev,
>    1008				   "(qp:0x%lx) starts, Poll cqe failed(%d) for mr 0x%x free! Remain %d cqe\n",
>    1009				   hr_qp->qpn, ret, hr_mr->key, ne);
>                                     ^^^^^^^^^^
> Unchecked dereference.
>
>    1010				goto free_work;
>    1011			}
>
> regards,
> dan carpenter
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [bug report] IB/hns: Fix the bug of polling cq failed for loopback Qps
       [not found]   ` <59769D18.4020400-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2017-07-25  7:11     ` Dan Carpenter
  2017-07-29  7:28       ` Wei Hu (Xavier)
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2017-07-25  7:11 UTC (permalink / raw)
  To: Wei Hu (Xavier)
  Cc: oulijun-hv44wF8Li93QT0dZR+AlfA, linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Tue, Jul 25, 2017 at 09:21:28AM +0800, Wei Hu (Xavier) wrote:
> Hi Dan Carpenter
> 
>     Thanks for your comments.
>     What is the checker tool? Where can I get it?

This is a Smatch check.  https://lwn.net/Articles/629250/

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [bug report] IB/hns: Fix the bug of polling cq failed for loopback Qps
  2017-07-25  7:11     ` Dan Carpenter
@ 2017-07-29  7:28       ` Wei Hu (Xavier)
       [not found]         ` <597C3939.2060407-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Wei Hu (Xavier) @ 2017-07-29  7:28 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: oulijun-hv44wF8Li93QT0dZR+AlfA, linux-rdma-u79uwXL29TY76Z2rM5mHXA



On 2017/7/25 15:11, Dan Carpenter wrote:
> This is a Smatch check.https://lwn.net/Articles/629250/
>
> regards,
> dan carpenter
Hi, Dan Carpenter

Thanks,
I have another question,
We use "make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- " to compile 
kernel with cross compiler.
If we want check only some files in some directories, how to use this 
smatch tool to check them?

Regards
Wei Hu

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [bug report] IB/hns: Fix the bug of polling cq failed for loopback Qps
       [not found]         ` <597C3939.2060407-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2017-07-31  8:07           ` Leon Romanovsky
       [not found]             ` <20170731080731.GT13672-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Leon Romanovsky @ 2017-07-31  8:07 UTC (permalink / raw)
  To: Wei Hu (Xavier)
  Cc: Dan Carpenter, oulijun-hv44wF8Li93QT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 858 bytes --]

On Sat, Jul 29, 2017 at 03:28:57PM +0800, Wei Hu (Xavier) wrote:
>
>
> On 2017/7/25 15:11, Dan Carpenter wrote:
> > This is a Smatch check.https://lwn.net/Articles/629250/
> >
> > regards,
> > dan carpenter
> Hi, Dan Carpenter
>
> Thanks,
> I have another question,
> We use "make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- " to compile kernel
> with cross compiler.
> If we want check only some files in some directories, how to use this smatch
> tool to check them?

You can provide relevant directories to the make call, something like that:
make CHECK="smatch -p=kernel" C=1 drivers/infiniband/hw/hns/


>
> Regards
> Wei Hu
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [bug report] IB/hns: Fix the bug of polling cq failed for loopback Qps
       [not found]             ` <20170731080731.GT13672-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-08-01  8:48               ` Wei Hu (Xavier)
  0 siblings, 0 replies; 7+ messages in thread
From: Wei Hu (Xavier) @ 2017-08-01  8:48 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Dan Carpenter, oulijun-hv44wF8Li93QT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA



On 2017/7/31 16:07, Leon Romanovsky wrote:
> On Sat, Jul 29, 2017 at 03:28:57PM +0800, Wei Hu (Xavier) wrote:
>>
>> On 2017/7/25 15:11, Dan Carpenter wrote:
>>> This is a Smatch check.https://lwn.net/Articles/629250/
>>>
>>> regards,
>>> dan carpenter
>> Hi, Dan Carpenter
>>
>> Thanks,
>> I have another question,
>> We use "make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- " to compile kernel
>> with cross compiler.
>> If we want check only some files in some directories, how to use this smatch
>> tool to check them?
> You can provide relevant directories to the make call, something like that:
> make CHECK="smatch -p=kernel" C=1 drivers/infiniband/hw/hns/
>
Thanks very much, Leon
I got it.

Regards
Wei Hu
>> Regards
>> Wei Hu
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
>> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2017-08-01  8:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-19 11:48 [bug report] IB/hns: Fix the bug of polling cq failed for loopback Qps Dan Carpenter
2017-07-20 11:41 ` oulijun
2017-07-25  1:21 ` Wei Hu (Xavier)
     [not found]   ` <59769D18.4020400-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-07-25  7:11     ` Dan Carpenter
2017-07-29  7:28       ` Wei Hu (Xavier)
     [not found]         ` <597C3939.2060407-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-07-31  8:07           ` Leon Romanovsky
     [not found]             ` <20170731080731.GT13672-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-08-01  8:48               ` Wei Hu (Xavier)

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