[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 3/6] dt-overlay: Remove ASSERT_UNREACHABLE from add_nodes()
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Michal Orzel <michal.orzel@xxxxxxx>
- Date: Fri, 4 Oct 2024 14:22:17 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RdOa3RV+tWRNRzTlY1JHgYomlKbBfTaAePYvs1PDYVw=; b=GY6R7tJbjTg2U9cW3OIh6LHRiLJ3lPriGGo6UuCy/9wVMvEZ0zFdymCrYiEl4N84p7VQvYGGAgZpGJqwh0rf5eGei8YWpw5tD5ay5Qv31vjxrH33yhe5HkQNcS7j2LdgvMdnopxnkamQghWxbqzHHpvOIeQqG5al8scqb9djx9l7JoJX+5LyVzzj9f8iOOPGAGBANKahgH4J7SnFX9au6U4F3gp75kuwqFvgQXaRnxFXHb6eJjNxL1motM6sNMFl3DZklzaEY0r8WXndyM5I0NPd5K87IJhEuBH4lNMUTFRWdBBYKOL+HqIa5aAP0/m4rCP77/bVhEkz27tsjJf8aQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ayrvRtm/FEIs5YtgeD8OvCq9IXNE3lwjuacSb1LGre09rW0RwOBpOSozJNmLC5gSXSyJESHDqpAg6gXaOEihabrsiK5oB8z4OldyhDDQGBbHnFYwl/YxP1/zyxpXtwKZANPaBi8z8j2llPcwqlNb0pfF254H0rD7wBl5UxbWiUrctt6ruiFOS22EbxAzl975xfj43OE7iZ3LYeoCQPFwtcsp2lEjZQQ1cGx4XR1bhtf2r9B5dwECmUERKnlxeB3vTbAtJFQniDGAVhyw9iNPuEdFNzdGA1rE4I7e/6BUwkpLhgQ7yk6cg8yP5ogf4Qx4tsBX+gh/9bqjvnDw1BDLXQ==
- Cc: Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>
- Delivery-date: Fri, 04 Oct 2024 12:22:51 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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@xxxxxxx>
Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
---
Changes in v2:
- Add Rb,Ab
---
xen/common/dt-overlay.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
index 8606b14d1e8e..d18bd12bd38d 100644
--- a/xen/common/dt-overlay.c
+++ b/xen/common/dt-overlay.c
@@ -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
--
2.25.1
|