linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Colin King <colin.king@canonical.com>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][next] Bluetooth: use bitmap_empty to check if a bitmap has any bits set
Date: Thu, 7 Oct 2021 08:34:54 -0700	[thread overview]
Message-ID: <CABBYNZKzVtyZ_qO8pvenSLFRdm9aumxD_-Src4VG3UHQa8y+1w@mail.gmail.com> (raw)
In-Reply-To: <20211007111713.12207-1-colin.king@canonical.com>

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

  reply	other threads:[~2021-10-07 15:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 15:34 ` Luiz Augusto von Dentz [this message]
2021-10-07 15:39   ` Colin Ian King
2021-10-07 15:47   ` Marcel Holtmann
2021-10-07 15:53     ` Luiz Augusto von Dentz

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=CABBYNZKzVtyZ_qO8pvenSLFRdm9aumxD_-Src4VG3UHQa8y+1w@mail.gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=colin.king@canonical.com \
    --cc=davem@davemloft.net \
    --cc=johan.hedberg@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    /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).