Skip to content

Commit

Permalink
iommu/vt-d: Fix error handling in ANDD processing
Browse files Browse the repository at this point in the history
If we failed to find an ACPI device to correspond to an ANDD record, we
would fail to increment our pointer and would just process the same record
over and over again, with predictable results.

Turn it from a while() loop into a for() loop to let the 'continue' in
the error paths work correctly.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Apr 1, 2014
1 parent 14d4056 commit 7713ec0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/iommu/dmar.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,10 +662,9 @@ static int __init dmar_acpi_dev_scope_init(void)
if (dmar_tbl == NULL)
return -ENODEV;

andd = (void *)dmar_tbl + sizeof(struct acpi_table_dmar);

while (((unsigned long)andd) <
((unsigned long)dmar_tbl) + dmar_tbl->length) {
for (andd = (void *)dmar_tbl + sizeof(struct acpi_table_dmar);
((unsigned long)andd) < ((unsigned long)dmar_tbl) + dmar_tbl->length;
andd = ((void *)andd) + andd->header.length) {
if (andd->header.type == ACPI_DMAR_TYPE_ANDD) {
acpi_handle h;
struct acpi_device *adev;
Expand All @@ -685,7 +684,6 @@ static int __init dmar_acpi_dev_scope_init(void)
}
dmar_acpi_insert_dev_scope(andd->device_number, adev);
}
andd = ((void *)andd) + andd->header.length;
}
return 0;
}
Expand Down

0 comments on commit 7713ec0

Please sign in to comment.