diff mbox series

Bluetooth: L2CAP: Fix build errors in some archs

Message ID 20220812223939.530428-1-luiz.dentz@gmail.com
State New
Headers show
Series Bluetooth: L2CAP: Fix build errors in some archs | expand

Commit Message

Luiz Augusto von Dentz Aug. 12, 2022, 10:39 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This attempts to fix the follow errors:

In function 'memcmp',
    inlined from 'bacmp' at ./include/net/bluetooth/bluetooth.h:347:9,
    inlined from 'l2cap_global_chan_by_psm' at
    net/bluetooth/l2cap_core.c:2003:15:
./include/linux/fortify-string.h:44:33: error: '__builtin_memcmp'
specified bound 6 exceeds source size 0 [-Werror=stringop-overread]
   44 | #define __underlying_memcmp     __builtin_memcmp
      |                                 ^
./include/linux/fortify-string.h:420:16: note: in expansion of macro
'__underlying_memcmp'
  420 |         return __underlying_memcmp(p, q, size);
      |                ^~~~~~~~~~~~~~~~~~~
In function 'memcmp',
    inlined from 'bacmp' at ./include/net/bluetooth/bluetooth.h:347:9,
    inlined from 'l2cap_global_chan_by_psm' at
    net/bluetooth/l2cap_core.c:2004:15:
./include/linux/fortify-string.h:44:33: error: '__builtin_memcmp'
specified bound 6 exceeds source size 0 [-Werror=stringop-overread]
   44 | #define __underlying_memcmp     __builtin_memcmp
      |                                 ^
./include/linux/fortify-string.h:420:16: note: in expansion of macro
'__underlying_memcmp'
  420 |         return __underlying_memcmp(p, q, size);
      |                ^~~~~~~~~~~~~~~~~~~

Fixes: 332f1795ca20 ("Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm regression")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/l2cap_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Sudip Mukherjee Aug. 13, 2022, 7:30 a.m. UTC | #1
Hi Luiz,

On Sat, Aug 13, 2022 at 12:12 AM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Palmer, Sudip,
>
> On Fri, Aug 12, 2022 at 4:05 PM <bluez.test.bot@gmail.com> wrote:
> >
> > 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=667285
>
> Could you guys try with the above change, I think the culprit is
> actually setting c = NULL which triggers some compiler to think it may
> be passed to bacmp.

I get "No patches to display" on that link.
Luiz Augusto von Dentz Aug. 13, 2022, 7:32 p.m. UTC | #2
Hi Sudip,

On Sat, Aug 13, 2022 at 12:31 AM Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
>
> Hi Luiz,
>
> On Sat, Aug 13, 2022 at 12:12 AM Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
> >
> > Hi Palmer, Sudip,
> >
> > On Fri, Aug 12, 2022 at 4:05 PM <bluez.test.bot@gmail.com> wrote:
> > >
> > > 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=667285
> >
> > Could you guys try with the above change, I think the culprit is
> > actually setting c = NULL which triggers some compiler to think it may
> > be passed to bacmp.
>
> I get "No patches to display" on that link.

That is probably because Ive send a v2:

https://patchwork.kernel.org/project/bluetooth/list/?series=667289

>
> --
> Regards
> Sudip
Luiz Augusto von Dentz Aug. 15, 2022, 5:55 p.m. UTC | #3
Hi Sudip,

On Sun, Aug 14, 2022 at 3:48 AM Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
>
> Hi Luiz,
>
> On Sat, Aug 13, 2022 at 8:32 PM Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
> >
> > Hi Sudip,
> >
> > On Sat, Aug 13, 2022 at 12:31 AM Sudip Mukherjee
> > <sudipm.mukherjee@gmail.com> wrote:
> > >
> > > Hi Luiz,
> > >
> > > On Sat, Aug 13, 2022 at 12:12 AM Luiz Augusto von Dentz
> > > <luiz.dentz@gmail.com> wrote:
> > > >
> > > > Hi Palmer, Sudip,
> > > >
> > > > On Fri, Aug 12, 2022 at 4:05 PM <bluez.test.bot@gmail.com> wrote:
> > > > >
> > > > > 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=667285
> > > >
> > > > Could you guys try with the above change, I think the culprit is
> > > > actually setting c = NULL which triggers some compiler to think it may
> > > > be passed to bacmp.
> > >
> > > I get "No patches to display" on that link.
> >
> > That is probably because Ive send a v2:
>
> I have not tested your patch as the build failure is not present with
> the bluetooth master branch. Please let me know if this was the wrong
> branch.

And you can't apply on top of the tree that you are able to reproduce?

>
> --
> Regards
> Sudip
Sudip Mukherjee Aug. 18, 2022, 9:28 p.m. UTC | #4
On Mon, Aug 15, 2022 at 6:55 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Sudip,
>
> On Sun, Aug 14, 2022 at 3:48 AM Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> >
> > Hi Luiz,
> >
> > On Sat, Aug 13, 2022 at 8:32 PM Luiz Augusto von Dentz
> > <luiz.dentz@gmail.com> wrote:
> > >
> > > Hi Sudip,
> > >
> > > On Sat, Aug 13, 2022 at 12:31 AM Sudip Mukherjee
> > > <sudipm.mukherjee@gmail.com> wrote:
> > > >
> > > > Hi Luiz,
> > > >
> > > > On Sat, Aug 13, 2022 at 12:12 AM Luiz Augusto von Dentz
> > > > <luiz.dentz@gmail.com> wrote:
> > > > >
> > > > > Hi Palmer, Sudip,
> > > > >
> > > > > On Fri, Aug 12, 2022 at 4:05 PM <bluez.test.bot@gmail.com> wrote:
> > > > > >
> > > > > > 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=667285
> > > > >
> > > > > Could you guys try with the above change, I think the culprit is
> > > > > actually setting c = NULL which triggers some compiler to think it may
> > > > > be passed to bacmp.
> > > >
> > > > I get "No patches to display" on that link.
> > >
> > > That is probably because Ive send a v2:
> >
> > I have not tested your patch as the build failure is not present with
> > the bluetooth master branch. Please let me know if this was the wrong
> > branch.
>
> And you can't apply on top of the tree that you are able to reproduce?

I can see its already in linux-next and I don't see those build
failures on next-20220818.
Luiz Augusto von Dentz Aug. 18, 2022, 10:03 p.m. UTC | #5
Hi Sudip,

On Thu, Aug 18, 2022 at 2:29 PM Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
>
> On Mon, Aug 15, 2022 at 6:55 PM Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
> >
> > Hi Sudip,
> >
> > On Sun, Aug 14, 2022 at 3:48 AM Sudip Mukherjee
> > <sudipm.mukherjee@gmail.com> wrote:
> > >
> > > Hi Luiz,
> > >
> > > On Sat, Aug 13, 2022 at 8:32 PM Luiz Augusto von Dentz
> > > <luiz.dentz@gmail.com> wrote:
> > > >
> > > > Hi Sudip,
> > > >
> > > > On Sat, Aug 13, 2022 at 12:31 AM Sudip Mukherjee
> > > > <sudipm.mukherjee@gmail.com> wrote:
> > > > >
> > > > > Hi Luiz,
> > > > >
> > > > > On Sat, Aug 13, 2022 at 12:12 AM Luiz Augusto von Dentz
> > > > > <luiz.dentz@gmail.com> wrote:
> > > > > >
> > > > > > Hi Palmer, Sudip,
> > > > > >
> > > > > > On Fri, Aug 12, 2022 at 4:05 PM <bluez.test.bot@gmail.com> wrote:
> > > > > > >
> > > > > > > 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=667285
> > > > > >
> > > > > > Could you guys try with the above change, I think the culprit is
> > > > > > actually setting c = NULL which triggers some compiler to think it may
> > > > > > be passed to bacmp.
> > > > >
> > > > > I get "No patches to display" on that link.
> > > >
> > > > That is probably because Ive send a v2:
> > >
> > > I have not tested your patch as the build failure is not present with
> > > the bluetooth master branch. Please let me know if this was the wrong
> > > branch.
> >
> > And you can't apply on top of the tree that you are able to reproduce?
>
> I can see its already in linux-next and I don't see those build
> failures on next-20220818.

Alright, I will send a pull request including it later this week just
in case it reappears for some reason.

>
> --
> Regards
> Sudip
Sudip Mukherjee Aug. 19, 2022, 7:28 a.m. UTC | #6
On Thu, Aug 18, 2022 at 11:04 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Sudip,
>
> On Thu, Aug 18, 2022 at 2:29 PM Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> >
> > On Mon, Aug 15, 2022 at 6:55 PM Luiz Augusto von Dentz
> > <luiz.dentz@gmail.com> wrote:
> > >
> > > Hi Sudip,
> > >
> > > On Sun, Aug 14, 2022 at 3:48 AM Sudip Mukherjee
> > > <sudipm.mukherjee@gmail.com> wrote:
> > > >
> > > > Hi Luiz,
> > > >
> > > > On Sat, Aug 13, 2022 at 8:32 PM Luiz Augusto von Dentz
> > > > <luiz.dentz@gmail.com> wrote:
> > > > >
> > > > > Hi Sudip,
> > > > >
> > > > > On Sat, Aug 13, 2022 at 12:31 AM Sudip Mukherjee
> > > > > <sudipm.mukherjee@gmail.com> wrote:
> > > > > >
> > > > > > Hi Luiz,
> > > > > >
> > > > > > On Sat, Aug 13, 2022 at 12:12 AM Luiz Augusto von Dentz
> > > > > > <luiz.dentz@gmail.com> wrote:
> > > > > > >
> > > > > > > Hi Palmer, Sudip,
> > > > > > >
> > > > > > > On Fri, Aug 12, 2022 at 4:05 PM <bluez.test.bot@gmail.com> wrote:
> > > > > > > >
> > > > > > > > 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=667285
> > > > > > >
> > > > > > > Could you guys try with the above change, I think the culprit is
> > > > > > > actually setting c = NULL which triggers some compiler to think it may
> > > > > > > be passed to bacmp.
> > > > > >
> > > > > > I get "No patches to display" on that link.
> > > > >
> > > > > That is probably because Ive send a v2:
> > > >
> > > > I have not tested your patch as the build failure is not present with
> > > > the bluetooth master branch. Please let me know if this was the wrong
> > > > branch.
> > >
> > > And you can't apply on top of the tree that you are able to reproduce?
> >
> > I can see its already in linux-next and I don't see those build
> > failures on next-20220818.
>
> Alright, I will send a pull request including it later this week just
> in case it reappears for some reason.

Just to be clear, the build failure is still there on the mainline
branch from Linus. But next-20220818, which has the fixes does not
show the build failure. So, it will be needed for Linus tree.
Luiz Augusto von Dentz Aug. 19, 2022, 6:49 p.m. UTC | #7
Hi Sudip,

On Fri, Aug 19, 2022 at 12:28 AM Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
>
> On Thu, Aug 18, 2022 at 11:04 PM Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
> >
> > Hi Sudip,
> >
> > On Thu, Aug 18, 2022 at 2:29 PM Sudip Mukherjee
> > <sudipm.mukherjee@gmail.com> wrote:
> > >
> > > On Mon, Aug 15, 2022 at 6:55 PM Luiz Augusto von Dentz
> > > <luiz.dentz@gmail.com> wrote:
> > > >
> > > > Hi Sudip,
> > > >
> > > > On Sun, Aug 14, 2022 at 3:48 AM Sudip Mukherjee
> > > > <sudipm.mukherjee@gmail.com> wrote:
> > > > >
> > > > > Hi Luiz,
> > > > >
> > > > > On Sat, Aug 13, 2022 at 8:32 PM Luiz Augusto von Dentz
> > > > > <luiz.dentz@gmail.com> wrote:
> > > > > >
> > > > > > Hi Sudip,
> > > > > >
> > > > > > On Sat, Aug 13, 2022 at 12:31 AM Sudip Mukherjee
> > > > > > <sudipm.mukherjee@gmail.com> wrote:
> > > > > > >
> > > > > > > Hi Luiz,
> > > > > > >
> > > > > > > On Sat, Aug 13, 2022 at 12:12 AM Luiz Augusto von Dentz
> > > > > > > <luiz.dentz@gmail.com> wrote:
> > > > > > > >
> > > > > > > > Hi Palmer, Sudip,
> > > > > > > >
> > > > > > > > On Fri, Aug 12, 2022 at 4:05 PM <bluez.test.bot@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > 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=667285
> > > > > > > >
> > > > > > > > Could you guys try with the above change, I think the culprit is
> > > > > > > > actually setting c = NULL which triggers some compiler to think it may
> > > > > > > > be passed to bacmp.
> > > > > > >
> > > > > > > I get "No patches to display" on that link.
> > > > > >
> > > > > > That is probably because Ive send a v2:
> > > > >
> > > > > I have not tested your patch as the build failure is not present with
> > > > > the bluetooth master branch. Please let me know if this was the wrong
> > > > > branch.
> > > >
> > > > And you can't apply on top of the tree that you are able to reproduce?
> > >
> > > I can see its already in linux-next and I don't see those build
> > > failures on next-20220818.
> >
> > Alright, I will send a pull request including it later this week just
> > in case it reappears for some reason.
>
> Just to be clear, the build failure is still there on the mainline
> branch from Linus. But next-20220818, which has the fixes does not
> show the build failure. So, it will be needed for Linus tree.

So I assume one next is merged into the Linus tree that should take
care of these errors.

>
> --
> Regards
> Sudip
diff mbox series

Patch

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 1c39fc40591b..1dc05c77c22f 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1992,12 +1992,12 @@  static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm,
 			src_match = !bacmp(&c->src, src);
 			dst_match = !bacmp(&c->dst, dst);
 			if (src_match && dst_match) {
-				c = l2cap_chan_hold_unless_zero(c);
-				if (!c)
+				c1 = l2cap_chan_hold_unless_zero(c);
+				if (!c1)
 					continue;
 
 				read_unlock(&chan_list_lock);
-				return c;
+				return c1;
 			}
 
 			/* Closest match */