RE: [PATCH] Bluetooth: L2CAP: Elide a string overflow warning

From: Siddh Raman Pant
Date: Thu Sep 01 2022 - 03:49:41 EST


On Tue, 30 Aug 2022 01:21:58 +0530 Elliott, Robert (Servers) wrote:
> > -----Original Message-----
> > From: Siddh Raman Pant code@xxxxxxxx>
> > Sent: Thursday, August 25, 2022 6:01 AM
> > To: palmer@xxxxxxxxxxxx
> > Cc: davem@xxxxxxxxxxxxx; edumazet@xxxxxxxxxx; johan.hedberg@xxxxxxxxx;
> > kuba@xxxxxxxxxx; linux-bluetooth@xxxxxxxxxxxxxxx; linux-
> > kernel@xxxxxxxxxxxxxxx; linux@xxxxxxxxxxxx; luiz.dentz@xxxxxxxxx;
> > marcel@xxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; pabeni@xxxxxxxxxx
> > Subject: Re: [PATCH] Bluetooth: L2CAP: Elide a string overflow warning
> >
> > On Fri, 12 Aug 2022 11:22:49 +0530 Palmer Dabbelt wrote:
> > > From: Palmer Dabbelt palmer@xxxxxxxxxxxx>
> > >
> > > Without this I get a string op warning related to copying from a
> > > possibly NULL pointer. I think the warning is spurious, but it's
> > > tripping up allmodconfig.
> >
> > I think it is not spurious, and is due to the following commit:
> > d0be8347c623 ("Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put")
>
> That commit was OK - it added an "if (!c) continue" to handle if
> the value c is changed to NULL.
>
> > The following commit fixes a similar problem (added the NULL check on line
> > 1996):
> > 332f1795ca20 ("Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm regression")
>
> That commit wiped out the "if (!c) continue" path escape clause
> from the previous patch, introducing a path back to code that
> doesn't check for NULL:

You are correct, thanks for clarifying. Sorry for getting it reversed.

So I think this patch can be modified to just introduce back the escape
clause rather than having an extra indentation.

Thanks,
Siddh