All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH v2] Bluetooth: MGMT: Fix uses of bitmap_from_u64
Date: Thu, 19 May 2022 13:11:16 -0700	[thread overview]
Message-ID: <CABBYNZKbRhOaUz263-rS9GOUh=rbwNs2NfUWyaZ0Rgrt_Zm0fg@mail.gmail.com> (raw)
In-Reply-To: <4A5486C7-C1E8-41A3-9E7F-E627BBA79503@holtmann.org>

Hi Marcel,

On Thu, May 19, 2022 at 11:09 AM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Luiz,
>
> > bitmap_from_u64 expects at least 8 bytes to be declared since it doesn't
> > take any parameter regarding the number of bits causing the following
> > warnings:
> >
> > In file included from include/linux/cpumask.h:12,
> >                 from include/linux/mm_types_task.h:14,
> >                 from include/linux/mm_types.h:5,
> >                 from include/linux/buildid.h:5,
> >                 from include/linux/module.h:14,
> >                 from net/bluetooth/mgmt.c:27:
> > In function 'bitmap_copy',
> >    inlined from 'bitmap_copy_clear_tail' at include/linux/bitmap.h:270:2,
> >    inlined from 'bitmap_from_u64' at include/linux/bitmap.h:622:2,
> >    inlined from 'set_device_flags' at net/bluetooth/mgmt.c:4534:4:
> > include/linux/bitmap.h:261:9: warning: 'memcpy' forming offset [4, 7] is
> > out of the bounds [0, 4] of object 'flags' with type
> > 'long unsigned int[1]' [-Warray-bounds]
> >  261 |         memcpy(dst, src, len);
> >      |         ^~~~~~~~~~~~~~~~~~~~~
> > In file included from include/linux/kasan-checks.h:5,
> >                 from include/asm-generic/rwonce.h:26,
> >                 from ./arch/arm/include/generated/asm/rwonce.h:1,
> >                 from include/linux/compiler.h:248,
> >                 from include/linux/build_bug.h:5,
> >                 from include/linux/container_of.h:5,
> >                 from include/linux/list.h:5,
> >                 from include/linux/module.h:12,
> >                 from net/bluetooth/mgmt.c:27:
> > net/bluetooth/mgmt.c: In function 'set_device_flags':
> > net/bluetooth/mgmt.c:4532:40: note: 'flags' declared here
> > 4532 |                         DECLARE_BITMAP(flags, __HCI_CONN_NUM_FLAGS);
> >      |                                        ^~~~~
> > include/linux/types.h:11:23: note: in definition of macro 'DECLARE_BITMAP'
> >   11 |         unsigned long name[BITS_TO_LONGS(bits)]
> >      |                       ^~~~
> >
> > In order to fix the above this initializes a variable using
> > DECLARE_BITMAP with the current_flags and then uses bitmap_subset to
> > check if the flags being set are a subset of hdev->conn_flags that way
> > all the checks are performed using bitmap APIs and conversion to u32
> > only happen when really needed.
> >
> > Fixes: a9a347655d22 ("Bluetooth: MGMT: Add conditions for setting HCI_CONN_FLAG_REMOTE_WAKEUP")
> > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > Suggested-by: Yury Norov <yury.norov@gmail.com>
> > Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> > ---
> > net/bluetooth/mgmt.c | 43 ++++++++++++++++++-------------------------
> > 1 file changed, 18 insertions(+), 25 deletions(-)
>
> what is up with the kbot issues?

Will fix that.

> Regards
>
> Marcel
>


-- 
Luiz Augusto von Dentz

  reply	other threads:[~2022-05-19 20:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 20:35 [PATCH v2] Bluetooth: MGMT: Fix uses of bitmap_from_u64 Luiz Augusto von Dentz
2022-05-17  3:09 ` kernel test robot
2022-05-19 18:09 ` Marcel Holtmann
2022-05-19 20:11   ` Luiz Augusto von Dentz [this message]
2022-05-19 20:15 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='CABBYNZKbRhOaUz263-rS9GOUh=rbwNs2NfUWyaZ0Rgrt_Zm0fg@mail.gmail.com' \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.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 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.