linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Stone <ahs3@redhat.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>
Subject: Re: [PATCH 3/3] ACPI: fix acpi_parse_entries_array() so it reports overflow correctly
Date: Fri, 1 Jul 2016 16:38:05 -0600	[thread overview]
Message-ID: <203614ca-e846-4eac-fd6a-eb389b37fa08@redhat.com> (raw)
In-Reply-To: <CAJZ5v0i0sXTPP9S4ZAFNPRkatOkHUhYoFwuJS8-Tn8a3iT=-=A@mail.gmail.com>

On 07/01/2016 03:54 PM, Rafael J. Wysocki wrote:
> On Fri, Jul 1, 2016 at 11:44 PM, Al Stone <ahs3@redhat.com> wrote:
>> On 07/01/2016 03:40 PM, Rafael J. Wysocki wrote:
>>> On Fri, Jul 1, 2016 at 11:21 PM, Al Stone <ahs3@redhat.com> wrote:
>>>> The function acpi_parse_entries_array() has a limiting parameter,
>>>> max_entries, which tells the function to stop looking at subtables
>>>> once that limit has been reached.  Further, if the limit is reached,
>>>> it is reported.  However, the logic is incorrect in that the loop
>>>> to examine all subtables will always stop when exactly max_entries
>>>> have been found, regardless of whether or not there are still subtables
>>>> to examine, and it will always report that zero subtables have been
>>>> ignored.  This change allows the loop to continue to look at all
>>>> subtables and count all the ones of interest; if we have already
>>>> reached the number of max_entries, though, we will not invoke the
>>>> callback functions.  If the max_entries limit has been exceeded,
>>>> report on that, as before, but more accurately, listing how many
>>>> subtables of interest there are in total (as was meant), and how
>>>> many entries each subtable type occupied.
>>>
>>> The problem appears to be that, if max_entries has been reached, it
>>> prints "ignored 0", although it should count all of the entries in
>>> that case too in principle.  Do I think correctly?
>>>
>>
>> Exactly.  That's how I interpreted the comments.  And it fit what I
>> needed it to do if the comments were correct.
>>
>> Of course, it could be the code was correct and the comments were
>> wrong :).  I preferred not to think that.
> 
> I guess whoever implemented this function thought that the overhead
> for counting stuff was not useful in case max_entries had been
> reached.  I'm not really sure I disagree with that. :-)

I'm not sure I disagree, either :).

> I agree that printing "ignored 0" in that case is misleading, but the
> fix might be to simply avoid printing how many entries have been
> ignored then.  Maybe it will suffice to print how many entries have
> been found and what the limit was?

That could work.

Unless I've misunderstood the code, though, the situation that seemed likely
to me is, for example, to suppose that the first five subtables out of 20 are
of a single type and cause my max_entries limit to be reached.  If I have three
callbacks, I'd end up with two other callback functions that would never get
called, even if some of the remaining 15 subtables are pertinent and could help
get the boot process further along.

-- 
ciao,
al
-----------------------------------
Al Stone
Software Engineer
Red Hat, Inc.
ahs3@redhat.com
-----------------------------------

  reply	other threads:[~2016-07-01 22:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01 21:21 [PATCH 0/3] Correct errors in acpi_parse_entries_array() Al Stone
2016-07-01 21:21 ` [PATCH 1/3] ACPI: fix incorrect counts returned by acpi_parse_entries_array() Al Stone
2016-07-01 21:25   ` Rafael J. Wysocki
2016-07-01 21:36     ` Al Stone
2016-07-01 21:44       ` Rafael J. Wysocki
2016-07-01 21:50         ` Al Stone
2016-07-01 21:56           ` Rafael J. Wysocki
2016-07-01 22:38             ` Al Stone
2016-07-01 21:21 ` [PATCH 2/3] ACPI: fix acpi_parse_entries_array() so it traverses all subtables Al Stone
2016-07-01 21:32   ` Rafael J. Wysocki
2016-07-01 21:41     ` Al Stone
2016-07-01 21:46       ` Rafael J. Wysocki
2016-07-01 21:55         ` Al Stone
2016-07-01 22:01           ` Rafael J. Wysocki
2016-07-01 23:07             ` Al Stone
2016-07-01 23:27               ` Rafael J. Wysocki
2016-07-01 21:21 ` [PATCH 3/3] ACPI: fix acpi_parse_entries_array() so it reports overflow correctly Al Stone
2016-07-01 21:40   ` Rafael J. Wysocki
2016-07-01 21:44     ` Al Stone
2016-07-01 21:54       ` Rafael J. Wysocki
2016-07-01 22:38         ` Al Stone [this message]
2016-07-01 22:45           ` Rafael J. Wysocki

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=203614ca-e846-4eac-fd6a-eb389b37fa08@redhat.com \
    --to=ahs3@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    /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;
as well as URLs for NNTP newsgroup(s).