[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] ACPI/table: Always count matched and successfully parsed entries



commit cf5efd610fe58160ceba3b5daece79c6a245c8fc
Author:     Tomasz Nowicki <tomasz.nowicki@xxxxxxxxxx>
AuthorDate: Wed Sep 9 16:25:42 2015 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Sep 9 16:25:42 2015 +0200

    ACPI/table: Always count matched and successfully parsed entries
    
    acpi_parse_entries() allows to traverse all available table entries (aka
    subtables) by passing max_entries parameter equal to 0, but since its count
    variable is only incremented if max_entries is not 0, the function always
    returns 0 for max_entries equal to 0.  It would be more useful if it 
returned
    the number of entries matched instead, so make it increment count in that
    case too.
    
    Signed-off-by: Tomasz Nowicki <tomasz.nowicki@xxxxxxxxxx>
    [Linux commit 4ceacd02f5a1795c5c697e0345ee10beef675290]
    Signed-off-by: Shannon Zhao <shannon.zhao@xxxxxxxxxx>
---
 xen/drivers/acpi/tables.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/xen/drivers/acpi/tables.c b/xen/drivers/acpi/tables.c
index e57cf2a..1da2127 100644
--- a/xen/drivers/acpi/tables.c
+++ b/xen/drivers/acpi/tables.c
@@ -239,10 +239,13 @@ acpi_table_parse_entries(char *id,
                }
 
                if (entry->type == entry_id
-                   && (!max_entries || count++ < max_entries))
+                   && (!max_entries || count < max_entries)) {
                        if (handler(entry, table_end))
                                return -EINVAL;
 
+                       count++;
+               }
+
                entry = (struct acpi_subtable_header *)
                    ((unsigned long)entry + entry->length);
        }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.