All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Tomas Bortoli <tomasbortoli@gmail.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Jaganath Kanakkassery <jaganath.k.os@gmail.com>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	linux-bluetooth <linux-bluetooth@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: hci_event: potential out of bounds parsing ADV events
Date: Thu, 04 Apr 2019 06:35:21 +0000	[thread overview]
Message-ID: <20190404063521.GF32590@kadam> (raw)
In-Reply-To: <CAM_iQpWjwOwawBN3yiZ0F-B-HDSOW8KGfpLGhAsf5yE0A=wtDA@mail.gmail.com>

On Wed, Apr 03, 2019 at 03:51:18PM -0700, Cong Wang wrote:
> On Tue, Apr 2, 2019 at 1:15 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > On Tue, Apr 02, 2019 at 10:42:38AM -0700, Cong Wang wrote:
> > > > Btw, get rid of all the likely/unlikely() macros.  Then the other style
> > > > comment would be don't move the "ev = (void *)skb->data;" assignments
> > > > around.  It's ok to say:
> > >
> > >
> > > Similarly, pskb_may_pull() may reallocate skb's, although very unlikely
> > > for bluetooth case (skb's are linear). At least it doesn't harm anything
> > > we move the skb->data dereference after pskb_may_pull().
> > >
> >
> > It harms readability.
> 
> Why? I can't see how it harms readability if you have pskb_may_pull()
> in mind that it potentially reallocates skb->data.

You're making the code more complicated because you're pretending that
we didn't linearize the skb data already...  :/

regards,
dan carpenter

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Tomas Bortoli <tomasbortoli@gmail.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Jaganath Kanakkassery <jaganath.k.os@gmail.com>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	linux-bluetooth <linux-bluetooth@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: hci_event: potential out of bounds parsing ADV events
Date: Thu, 4 Apr 2019 09:35:21 +0300	[thread overview]
Message-ID: <20190404063521.GF32590@kadam> (raw)
In-Reply-To: <CAM_iQpWjwOwawBN3yiZ0F-B-HDSOW8KGfpLGhAsf5yE0A=wtDA@mail.gmail.com>

On Wed, Apr 03, 2019 at 03:51:18PM -0700, Cong Wang wrote:
> On Tue, Apr 2, 2019 at 1:15 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > On Tue, Apr 02, 2019 at 10:42:38AM -0700, Cong Wang wrote:
> > > > Btw, get rid of all the likely/unlikely() macros.  Then the other style
> > > > comment would be don't move the "ev = (void *)skb->data;" assignments
> > > > around.  It's ok to say:
> > >
> > >
> > > Similarly, pskb_may_pull() may reallocate skb's, although very unlikely
> > > for bluetooth case (skb's are linear). At least it doesn't harm anything
> > > we move the skb->data dereference after pskb_may_pull().
> > >
> >
> > It harms readability.
> 
> Why? I can't see how it harms readability if you have pskb_may_pull()
> in mind that it potentially reallocates skb->data.

You're making the code more complicated because you're pretending that
we didn't linearize the skb data already...  :/

regards,
dan carpenter

  reply	other threads:[~2019-04-04  6:35 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-30  7:25 [PATCH] Bluetooth: hci_event: potential out of bounds parsing ADV events Dan Carpenter
2019-03-30  7:25 ` Dan Carpenter
2019-03-30  9:20 ` Tomas Bortoli
2019-03-30  9:20   ` Tomas Bortoli
2019-03-30 22:44   ` Tomas Bortoli
2019-03-30 22:44     ` Tomas Bortoli
2019-04-01  6:32     ` Dan Carpenter
2019-04-01  6:32       ` Dan Carpenter
2019-04-01 17:24       ` Tomas Bortoli
2019-04-01 17:24         ` Tomas Bortoli
2019-04-01 17:41         ` Dan Carpenter
2019-04-01 17:41           ` Dan Carpenter
2019-04-03  6:54         ` Jaganath K
2019-04-03  6:55           ` Jaganath K
2019-04-01 18:03   ` Cong Wang
2019-04-01 18:03     ` Cong Wang
2019-04-02  6:33     ` Dan Carpenter
2019-04-02  6:33       ` Dan Carpenter
2019-04-02 17:42       ` Cong Wang
2019-04-02 17:42         ` Cong Wang
2019-04-02 18:46         ` Tomas Bortoli
2019-04-02 18:46           ` Tomas Bortoli
2019-04-02 19:55         ` Dan Carpenter
2019-04-02 19:55           ` Dan Carpenter
2019-04-03 22:55           ` Cong Wang
2019-04-03 22:55             ` Cong Wang
2019-04-04  8:06             ` Dan Carpenter
2019-04-04  8:06               ` Dan Carpenter
2019-04-05 17:16               ` Cong Wang
2019-04-05 17:16                 ` Cong Wang
2019-04-05 20:48                 ` Dan Carpenter
2019-04-05 20:48                   ` Dan Carpenter
2019-04-05 21:05                   ` Tomas Bortoli
2019-04-05 21:05                     ` Tomas Bortoli
2019-04-05 21:14                     ` Dan Carpenter
2019-04-05 21:14                       ` Dan Carpenter
     [not found]                       ` <CAAHj5qj3PciY8ngqSGzH3=TQcm5vCghb0Z_0Y3DFQjTLMUM-9Q@mail.gmail.com>
2019-04-05 21:23                         ` Dan Carpenter
2019-04-05 21:23                           ` Dan Carpenter
2019-04-02 20:13         ` Dan Carpenter
2019-04-02 20:13           ` Dan Carpenter
2019-04-03 22:51           ` Cong Wang
2019-04-03 22:51             ` Cong Wang
2019-04-04  6:35             ` Dan Carpenter [this message]
2019-04-04  6:35               ` Dan Carpenter
2019-04-05 16:28               ` Cong Wang
2019-04-05 16:28                 ` Cong Wang

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=20190404063521.GF32590@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=jaganath.k.os@gmail.com \
    --cc=johan.hedberg@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=tomasbortoli@gmail.com \
    --cc=xiyou.wangcong@gmail.com \
    /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.