ACPI/IORT: Fix iort_get_platform_device_domain() uninitialized pointer value
authorLorenzo Pieralisi <[email protected]>
Thu, 29 Nov 2018 09:55:59 +0000 (09:55 +0000)
committerCatalin Marinas <[email protected]>
Fri, 30 Nov 2018 17:28:39 +0000 (17:28 +0000)
Running the Clang static analyzer on IORT code detected the following
error:

Logic error: Branch condition evaluates to a garbage value

in

iort_get_platform_device_domain()

If the named component associated with a given device has no IORT
mappings, iort_get_platform_device_domain() exits its MSI mapping loop
with msi_parent pointer containing garbage, which can lead to erroneous
code path execution.

Initialize the msi_parent pointer, fixing the bug.

Fixes: d4f54a186667 ("ACPI: platform: setup MSI domain for ACPI based
platform device")
Reported-by: Patrick Bellasi <[email protected]>
Reviewed-by: Hanjun Guo <[email protected]>
Acked-by: Will Deacon <[email protected]>
Cc: Sudeep Holla <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Signed-off-by: Lorenzo Pieralisi <[email protected]>
Signed-off-by: Catalin Marinas <[email protected]>
drivers/acpi/arm64/iort.c

index 2a361e22d38d062e73d2ad4db2e5fb0c15c6913a..70f4e80b9246a16f62e9459925ef1efd9905d9f5 100644 (file)
@@ -700,7 +700,7 @@ static void iort_set_device_domain(struct device *dev,
  */
 static struct irq_domain *iort_get_platform_device_domain(struct device *dev)
 {
-       struct acpi_iort_node *node, *msi_parent;
+       struct acpi_iort_node *node, *msi_parent = NULL;
        struct fwnode_handle *iort_fwnode;
        struct acpi_iort_its_group *its;
        int i;