[edk2-devel] [PATCH] acpi/iort: check output reference for the real used mapping

Lorenzo Pieralisi lorenzo.pieralisi at arm.com
Tue Feb 25 14:57:02 UTC 2020


On Tue, Feb 25, 2020 at 05:01:36PM +0800, Heyi Guo wrote:
> The function iort_node_map_id() does the sanity check against the
> first mapping in the node, but not the one which we really use.
> 
> Logically we need check the mapping we use, or check every mapping in
> the node. Choose the first fix for we are not firmware tester.

Yes, I agree with you, I will think about what's best to do, can
I pick up this patch and resend it on your behalf please ?

Thanks,
Lorenzo

> Signed-off-by: Heyi Guo <guoheyi at huawei.com>
> 
> ---
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi at arm.com>
> Cc: Hanjun Guo <guohanjun at huawei.com>
> Cc: Sudeep Holla <sudeep.holla at arm.com>
> Cc: "Rafael J. Wysocki" <rjw at rjwysocki.net>
> Cc: Len Brown <lenb at kernel.org>
> Cc: linux-acpi at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> ---
>  drivers/acpi/arm64/iort.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index ed3d2d1a7ae9..d0fe8d673240 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -470,13 +470,6 @@ static struct acpi_iort_node *iort_node_map_id(struct acpi_iort_node *node,
>  		map = ACPI_ADD_PTR(struct acpi_iort_id_mapping, node,
>  				   node->mapping_offset);
>  
> -		/* Firmware bug! */
> -		if (!map->output_reference) {
> -			pr_err(FW_BUG "[node %p type %d] ID map has NULL parent reference\n",
> -			       node, node->type);
> -			goto fail_map;
> -		}
> -
>  		/*
>  		 * Get the special ID mapping index (if any) and skip its
>  		 * associated ID map to prevent erroneous multi-stage
> @@ -497,6 +490,13 @@ static struct acpi_iort_node *iort_node_map_id(struct acpi_iort_node *node,
>  		if (i == node->mapping_count)
>  			goto fail_map;
>  
> +		/* Firmware bug! */
> +		if (!map->output_reference) {
> +			pr_err(FW_BUG "[node %p type %d] ID map has NULL parent reference\n",
> +			       node, node->type);
> +			goto fail_map;
> +		}
> +
>  		node = ACPI_ADD_PTR(struct acpi_iort_node, iort_table,
>  				    map->output_reference);
>  	}
> -- 
> 2.19.1
> 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#54791): https://edk2.groups.io/g/devel/message/54791
Mute This Topic: https://groups.io/mt/71530000/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list