All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] Bluetooth: use bitmap_empty to check if a bitmap has any bits set
@ 2021-10-07 11:17 Colin King
  2021-10-07 12:05 ` [next] " bluez.test.bot
  2021-10-07 15:34 ` [PATCH][next] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 6+ messages in thread
From: Colin King @ 2021-10-07 11:17 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	David S . Miller, Jakub Kicinski, linux-bluetooth, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The check to see if any tasks are left checks if bitmap array is zero
rather than using the appropriate bitmap helper functions to check the
bits in the array. Fix this by using bitmap_empty on the bitmap.

Addresses-Coverity: (" Array compared against 0")
Fixes: 912730b52552 ("Bluetooth: Fix wake up suspend_wait_q prematurely")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 net/bluetooth/hci_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 209f4fe17237..bad3b9c895ba 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -1108,7 +1108,7 @@ static void suspend_req_complete(struct hci_dev *hdev, u8 status, u16 opcode)
 	clear_bit(SUSPEND_SET_ADV_FILTER, hdev->suspend_tasks);
 
 	/* Wake up only if there are no tasks left */
-	if (!hdev->suspend_tasks)
+	if (!bitmap_empty(hdev->suspend_tasks, __SUSPEND_NUM_TASKS))
 		wake_up(&hdev->suspend_wait_q);
 }
 
-- 
2.32.0


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

* RE: [next] Bluetooth: use bitmap_empty to check if a bitmap has any bits set
  2021-10-07 11:17 [PATCH][next] Bluetooth: use bitmap_empty to check if a bitmap has any bits set Colin King
@ 2021-10-07 12:05 ` bluez.test.bot
  2021-10-07 15:34 ` [PATCH][next] " Luiz Augusto von Dentz
  1 sibling, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2021-10-07 12:05 UTC (permalink / raw)
  To: linux-bluetooth, colin.king

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

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=559055

---Test result---

Test Summary:
CheckPatch                    PASS      0.90 seconds
GitLint                       PASS      0.31 seconds
BuildKernel                   PASS      682.76 seconds
TestRunner: Setup             PASS      501.66 seconds
TestRunner: l2cap-tester      PASS      10.79 seconds
TestRunner: bnep-tester       PASS      5.66 seconds
TestRunner: mgmt-tester       PASS      95.25 seconds
TestRunner: rfcomm-tester     PASS      6.92 seconds
TestRunner: sco-tester        PASS      7.09 seconds
TestRunner: smp-tester        PASS      7.05 seconds
TestRunner: userchan-tester   PASS      5.88 seconds



---
Regards,
Linux Bluetooth


[-- Attachment #2: l2cap-tester.log --]
[-- Type: application/octet-stream, Size: 44356 bytes --]

[-- Attachment #3: bnep-tester.log --]
[-- Type: application/octet-stream, Size: 3563 bytes --]

[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 637807 bytes --]

[-- Attachment #5: rfcomm-tester.log --]
[-- Type: application/octet-stream, Size: 11683 bytes --]

[-- Attachment #6: sco-tester.log --]
[-- Type: application/octet-stream, Size: 13923 bytes --]

[-- Attachment #7: smp-tester.log --]
[-- Type: application/octet-stream, Size: 11829 bytes --]

[-- Attachment #8: userchan-tester.log --]
[-- Type: application/octet-stream, Size: 6371 bytes --]

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

* Re: [PATCH][next] Bluetooth: use bitmap_empty to check if a bitmap has any bits set
  2021-10-07 11:17 [PATCH][next] Bluetooth: use bitmap_empty to check if a bitmap has any bits set Colin King
  2021-10-07 12:05 ` [next] " bluez.test.bot
@ 2021-10-07 15:34 ` Luiz Augusto von Dentz
  2021-10-07 15:39   ` Colin Ian King
  2021-10-07 15:47   ` Marcel Holtmann
  1 sibling, 2 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2021-10-07 15:34 UTC (permalink / raw)
  To: Colin King
  Cc: Marcel Holtmann, Johan Hedberg, David S . Miller, Jakub Kicinski,
	linux-bluetooth, open list:NETWORKING [GENERAL],
	kernel-janitors, Linux Kernel Mailing List

Hi Colin,

On Thu, Oct 7, 2021 at 4:17 AM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The check to see if any tasks are left checks if bitmap array is zero
> rather than using the appropriate bitmap helper functions to check the
> bits in the array. Fix this by using bitmap_empty on the bitmap.
>
> Addresses-Coverity: (" Array compared against 0")
> Fixes: 912730b52552 ("Bluetooth: Fix wake up suspend_wait_q prematurely")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  net/bluetooth/hci_request.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
> index 209f4fe17237..bad3b9c895ba 100644
> --- a/net/bluetooth/hci_request.c
> +++ b/net/bluetooth/hci_request.c
> @@ -1108,7 +1108,7 @@ static void suspend_req_complete(struct hci_dev *hdev, u8 status, u16 opcode)
>         clear_bit(SUSPEND_SET_ADV_FILTER, hdev->suspend_tasks);
>
>         /* Wake up only if there are no tasks left */
> -       if (!hdev->suspend_tasks)
> +       if (!bitmap_empty(hdev->suspend_tasks, __SUSPEND_NUM_TASKS))
>                 wake_up(&hdev->suspend_wait_q);
>  }
>
> --
> 2.32.0

I was going to revert this change since it appears wake_up does
actually check the wake condition there is no premature wake up after
all.

-- 
Luiz Augusto von Dentz

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

* Re: [PATCH][next] Bluetooth: use bitmap_empty to check if a bitmap has any bits set
  2021-10-07 15:34 ` [PATCH][next] " Luiz Augusto von Dentz
@ 2021-10-07 15:39   ` Colin Ian King
  2021-10-07 15:47   ` Marcel Holtmann
  1 sibling, 0 replies; 6+ messages in thread
From: Colin Ian King @ 2021-10-07 15:39 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: Marcel Holtmann, Johan Hedberg, David S . Miller, Jakub Kicinski,
	linux-bluetooth, open list:NETWORKING [GENERAL],
	kernel-janitors, Linux Kernel Mailing List

On 07/10/2021 16:34, Luiz Augusto von Dentz wrote:
> Hi Colin,
> 
> On Thu, Oct 7, 2021 at 4:17 AM Colin King <colin.king@canonical.com> wrote:
>>
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The check to see if any tasks are left checks if bitmap array is zero
>> rather than using the appropriate bitmap helper functions to check the
>> bits in the array. Fix this by using bitmap_empty on the bitmap.
>>
>> Addresses-Coverity: (" Array compared against 0")
>> Fixes: 912730b52552 ("Bluetooth: Fix wake up suspend_wait_q prematurely")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>   net/bluetooth/hci_request.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
>> index 209f4fe17237..bad3b9c895ba 100644
>> --- a/net/bluetooth/hci_request.c
>> +++ b/net/bluetooth/hci_request.c
>> @@ -1108,7 +1108,7 @@ static void suspend_req_complete(struct hci_dev *hdev, u8 status, u16 opcode)
>>          clear_bit(SUSPEND_SET_ADV_FILTER, hdev->suspend_tasks);
>>
>>          /* Wake up only if there are no tasks left */
>> -       if (!hdev->suspend_tasks)
>> +       if (!bitmap_empty(hdev->suspend_tasks, __SUSPEND_NUM_TASKS))
>>                  wake_up(&hdev->suspend_wait_q);
>>   }
>>
>> --
>> 2.32.0
> 
> I was going to revert this change since it appears wake_up does
> actually check the wake condition there is no premature wake up after
> all.
> 
OK, makes sense.

Colin

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

* Re: [PATCH][next] Bluetooth: use bitmap_empty to check if a bitmap has any bits set
  2021-10-07 15:34 ` [PATCH][next] " Luiz Augusto von Dentz
  2021-10-07 15:39   ` Colin Ian King
@ 2021-10-07 15:47   ` Marcel Holtmann
  2021-10-07 15:53     ` Luiz Augusto von Dentz
  1 sibling, 1 reply; 6+ messages in thread
From: Marcel Holtmann @ 2021-10-07 15:47 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: Colin King, Johan Hedberg, David S. Miller, Jakub Kicinski,
	linux-bluetooth, open list:NETWORKING [GENERAL],
	kernel-janitors, Linux Kernel Mailing List

Hi Luiz,

>> The check to see if any tasks are left checks if bitmap array is zero
>> rather than using the appropriate bitmap helper functions to check the
>> bits in the array. Fix this by using bitmap_empty on the bitmap.
>> 
>> Addresses-Coverity: (" Array compared against 0")
>> Fixes: 912730b52552 ("Bluetooth: Fix wake up suspend_wait_q prematurely")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>> net/bluetooth/hci_request.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
>> index 209f4fe17237..bad3b9c895ba 100644
>> --- a/net/bluetooth/hci_request.c
>> +++ b/net/bluetooth/hci_request.c
>> @@ -1108,7 +1108,7 @@ static void suspend_req_complete(struct hci_dev *hdev, u8 status, u16 opcode)
>>        clear_bit(SUSPEND_SET_ADV_FILTER, hdev->suspend_tasks);
>> 
>>        /* Wake up only if there are no tasks left */
>> -       if (!hdev->suspend_tasks)
>> +       if (!bitmap_empty(hdev->suspend_tasks, __SUSPEND_NUM_TASKS))
>>                wake_up(&hdev->suspend_wait_q);
>> }
>> 
>> --
>> 2.32.0
> 
> I was going to revert this change since it appears wake_up does
> actually check the wake condition there is no premature wake up after
> all.

so should I take the patch "Fix wake up suspend_wait_q prematurely” completely out?

Regards

Marcel


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

* Re: [PATCH][next] Bluetooth: use bitmap_empty to check if a bitmap has any bits set
  2021-10-07 15:47   ` Marcel Holtmann
@ 2021-10-07 15:53     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2021-10-07 15:53 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Colin King, Johan Hedberg, David S. Miller, Jakub Kicinski,
	linux-bluetooth, open list:NETWORKING [GENERAL],
	kernel-janitors, Linux Kernel Mailing List

Hi Marcel,

On Thu, Oct 7, 2021 at 8:47 AM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Luiz,
>
> >> The check to see if any tasks are left checks if bitmap array is zero
> >> rather than using the appropriate bitmap helper functions to check the
> >> bits in the array. Fix this by using bitmap_empty on the bitmap.
> >>
> >> Addresses-Coverity: (" Array compared against 0")
> >> Fixes: 912730b52552 ("Bluetooth: Fix wake up suspend_wait_q prematurely")
> >> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> >> ---
> >> net/bluetooth/hci_request.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
> >> index 209f4fe17237..bad3b9c895ba 100644
> >> --- a/net/bluetooth/hci_request.c
> >> +++ b/net/bluetooth/hci_request.c
> >> @@ -1108,7 +1108,7 @@ static void suspend_req_complete(struct hci_dev *hdev, u8 status, u16 opcode)
> >>        clear_bit(SUSPEND_SET_ADV_FILTER, hdev->suspend_tasks);
> >>
> >>        /* Wake up only if there are no tasks left */
> >> -       if (!hdev->suspend_tasks)
> >> +       if (!bitmap_empty(hdev->suspend_tasks, __SUSPEND_NUM_TASKS))
> >>                wake_up(&hdev->suspend_wait_q);
> >> }
> >>
> >> --
> >> 2.32.0
> >
> > I was going to revert this change since it appears wake_up does
> > actually check the wake condition there is no premature wake up after
> > all.
>
> so should I take the patch "Fix wake up suspend_wait_q prematurely” completely out?

Yes, please take it out.

-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2021-10-07 15:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 11:17 [PATCH][next] Bluetooth: use bitmap_empty to check if a bitmap has any bits set Colin King
2021-10-07 12:05 ` [next] " bluez.test.bot
2021-10-07 15:34 ` [PATCH][next] " Luiz Augusto von Dentz
2021-10-07 15:39   ` Colin Ian King
2021-10-07 15:47   ` Marcel Holtmann
2021-10-07 15:53     ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.