]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
dt-overlay: Remove ASSERT_UNREACHABLE from add_nodes()
authorMichal Orzel <michal.orzel@amd.com>
Fri, 4 Oct 2024 12:22:17 +0000 (14:22 +0200)
committerJulien Grall <jgrall@amazon.com>
Thu, 10 Oct 2024 15:18:56 +0000 (16:18 +0100)
The assumption stated in the comment that the code will never get there
is incorrect. In overlay_get_nodes_info() we manually combine path from
target-path property with the node path by adding '/' as a separator.
This can differ from a path obtained by libfdt due to more advanced
logic used there which can for instance get rid of excessive slashes.
In case of incorrect target-path (e.g. target-path = "//axi"), the
comparison in dt_find_node_by_path_from() can fail triggering the assert
in debug builds.

Fixes: 0c0facdab6f5 ("xen/arm: Implement device tree node addition functionalities")
Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/common/dt-overlay.c

index 8606b14d1e8ec49cbad69058a562d4165e468c52..d18bd12bd38d4283217cd88eb61fe1705fa0e973 100644 (file)
@@ -596,11 +596,7 @@ static long add_nodes(struct overlay_track *tr, char **nodes_full_path)
         overlay_node = dt_find_node_by_path_from(tr->dt_host_new,
                                                  nodes_full_path[j]);
         if ( overlay_node == NULL )
-        {
-            /* Sanity check. But code will never come here. */
-            ASSERT_UNREACHABLE();
             return -EFAULT;
-        }
 
         /*
          * Find previous and next node to overlay_node in dt_host_new. We will