Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1677037pxb; Thu, 7 Oct 2021 12:40:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+yE+XihOoydLvxWuHN9kmVI3kDIOy4u94/VPWUYTW5yYsPtx6ucIWLkUu6ELLeS/Kej9j X-Received: by 2002:a05:6a00:1945:b0:44c:a955:35ea with SMTP id s5-20020a056a00194500b0044ca95535eamr6122033pfk.85.1633635606122; Thu, 07 Oct 2021 12:40:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633635606; cv=none; d=google.com; s=arc-20160816; b=ERN8kk9y8OCz59edA2ABorqEAhkuzsjx6mMKTpRjBmQsn1aOhe04EZPR92Oa5m1DE8 9NQ5/mgjC1cQLwL6tr41sSlqIHGjPNgoyD1xPH5joq9jGdAU6dKdXdletGAj50lRo0jg H8bJ68ZirSc4gIwNCiu/Pp8xYzIxypjkX+c5urLMoTP/O/mL7GMAEgdDLt1VsAixBENm SWU9je0bavC+Q75okw/YN9D0o6UoEwz46AR2IWOd6tPwCmQSBS+5r84rAYRprw8HzSRm Hd2/R02xm4spHftlOEbvKKOsR086llaypQ8KYvNv1tKnFW4kSuXvx62DPiEcp0ULnDoP UVRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=kQLHhYZt5H8Mi2y46KcHqBhChqQpdPSkwoXF0mMP65U=; b=vlngyUGdU3qJ1bYfP8KwMPBup1gOVosJRfnnMiwjxnkxr6sOHHynIO3X+qSjcRBvK5 +R3gUzYQA9gWTL/rCqnfRuYdZetJIGgP9CJTFlqgidx3wKRL9xdLDLdR1DPM8FoeqpqS 3Bp/DhBmFV8Qf83qGtVtw83wMDFPVKrTRCZsxg434lLRB6ym+X0QH4RaGzIOjTPKWMHY rODxhSVY8HkBeePdChUN5BhgHnwcc3+rK5Un3vXvjnhSpp/cTocV0MUtL3/TcJH5nuu6 NwL7dlDpMheb+jwwHnZUzvD6UDg+s+Z/eZJQ8kHaLi4mgKcxd+I/8bUGq7gVHxM4oJXr PIZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b12si313566pgs.233.2021.10.07.12.39.53; Thu, 07 Oct 2021 12:40:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241786AbhJGPth convert rfc822-to-8bit (ORCPT + 99 others); Thu, 7 Oct 2021 11:49:37 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:39927 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232870AbhJGPth (ORCPT ); Thu, 7 Oct 2021 11:49:37 -0400 Received: from smtpclient.apple (p5b3d2185.dip0.t-ipconnect.de [91.61.33.133]) by mail.holtmann.org (Postfix) with ESMTPSA id A8422CECE5; Thu, 7 Oct 2021 17:47:41 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: [PATCH][next] Bluetooth: use bitmap_empty to check if a bitmap has any bits set From: Marcel Holtmann In-Reply-To: Date: Thu, 7 Oct 2021 17:47:41 +0200 Cc: Colin King , Johan Hedberg , "David S. Miller" , Jakub Kicinski , "linux-bluetooth@vger.kernel.org" , "open list:NETWORKING [GENERAL]" , kernel-janitors@vger.kernel.org, Linux Kernel Mailing List Content-Transfer-Encoding: 8BIT Message-Id: <888C3A95-5410-4B53-8805-4BAE9A9E6010@holtmann.org> References: <20211007111713.12207-1-colin.king@canonical.com> To: Luiz Augusto von Dentz X-Mailer: Apple Mail (2.3654.120.0.1.13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> --- >> 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