From: Jean Delvare <jdelvare@suse.de>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH] firmware: dmi: Check DMI structure length
Date: Sat, 3 Jun 2017 23:14:23 +0200 [thread overview]
Message-ID: <20170603231423.388f70b2@endymion> (raw)
In-Reply-To: <CAHp75Vd1-9p4mZRie9cGG=giPt_2S-RfTfEo=fYRxYEOuv_EFw@mail.gmail.com>
On Fri, 2 Jun 2017 21:45:37 +0300, Andy Shevchenko wrote:
> On Fri, Jun 2, 2017 at 9:40 PM, Jean Delvare <jdelvare@suse.de> wrote:
> > On Thu, 1 Jun 2017 19:06:36 +0300, Andy Shevchenko wrote:
> >> Your commit message should answer to the question why and what.
> >> You didn't put it there.
> >> Moreover, the change above per se doesn't belong to this — one logical
> >> change per patch.
> >
> > I'm confused. These changes totally belong to this patch. They belong
> > so much to it, that's the very reason why they are not described
> > separately in the commit message.
> >
> > The purpose of the patch is to check that the records are large enough
> > to contain the fields we need to access. Setting a pointer beyond the
> > end of the record _before_ performing that check makes no sense.
> >
> > I did not include these changes as performance optimizations, I
> > included them because they make the code conceptually correct. It's
> > even clearer for the last instance, as we are dereferencing the pointer
> > immediately, but in my opinion, even setting a pointer to a location
> > which may not exist is equally wrong and confusing for the reader.
> > That's why I moved that code after the length checks.
>
> You are talking here explicitly about third case which I agreed on.
>
> The two first ones are not the same.
> You didn't dereference them before check since your check is not
> against pointer.
>
> So, basically it means you are checking pointer _indirectly_.
Correct.
> I think we already spent too much time on this one.
Agreed.
> If you wish to leave your changes, update commit message accordingly.
No.
--
Jean Delvare
SUSE L3 Support
next prev parent reply other threads:[~2017-06-03 21:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-01 13:08 [PATCH] firmware: dmi: Check DMI structure length Jean Delvare
2017-06-01 13:16 ` Andy Shevchenko
2017-06-01 14:40 ` Jean Delvare
2017-06-01 16:06 ` Andy Shevchenko
2017-06-02 18:40 ` Jean Delvare
2017-06-02 18:45 ` Andy Shevchenko
2017-06-03 21:14 ` Jean Delvare [this message]
2017-06-01 14:00 ` Mika Westerberg
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=20170603231423.388f70b2@endymion \
--to=jdelvare@suse.de \
--cc=andy.shevchenko@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox