From: Al Stone <ahs3@redhat.com>
To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: ahs3@redhat.com
Subject: [PATCH 0/3] Correct errors in acpi_parse_entries_array()
Date: Fri, 1 Jul 2016 15:21:18 -0600 [thread overview]
Message-ID: <1467408081-7418-1-git-send-email-ahs3@redhat.com> (raw)
In examining the function acpi_parse_entries_array() for use in another
patch series, I realized the commentary and the code do not agree.
Assuming the commentary is correct, this function will do as I need;
that is not, however, what it does.
The first patch fixes an error where only the very first count element
of a struct in an array of structs gets incremented. My understanding
of the comments is that the count element for each struct in the array
should be incremented instead. With the patch, it will.
The second patch causes the function to actually traverse all subtables
just like the comments indicate. Previously, on any sort of error the
loop would terminate completely, but I really do want to visit all of
the entries even if some need to be ignored.
The final patch corrects the printout when more entries are found than
can actually be handled. The original code would incorrectly count the
number of entries ignored since it would alway stop the traversal when
the limit on entries was reached, regardless of whether there were
additional entries that still had not been examined.
Looking at the direct and indirect users of acpi_parse_entries_array(),
they all appear to depend on the return value from the function being
either > 0 or < 0, and not a specific value. Hence, the changes here
have no effect on them.
However, the use case I have in mind traverses the MADT in order to
count not only subtables of a specific type, but also subtables of a
specific type that contain specific values. With these fixes, I can
make one call to acpi_parse_entries_array() using very small callback
functions and do what I need, and get the correct results.
Tested on arm64 and x86_64, with simple booting, comparison of boot
logs, and daily use over the last couple of days.
Al Stone (3):
ACPI: fix incorrect counts returned by acpi_parse_entries_array()
ACPI: fix acpi_parse_entries_array() so it traverses all subtables
ACPI: fix acpi_parse_entries_array() so it reports overflow correctly
drivers/acpi/tables.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
--
2.7.4
next reply other threads:[~2016-07-01 21:22 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-01 21:21 Al Stone [this message]
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
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=1467408081-7418-1-git-send-email-ahs3@redhat.com \
--to=ahs3@redhat.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).