lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260112142009.1006236-46-herve.codina@bootlin.com>
Date: Mon, 12 Jan 2026 15:19:35 +0100
From: Herve Codina <herve.codina@...tlin.com>
To: David Gibson <david@...son.dropbear.id.au>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>
Cc: Ayush Singh <ayush@...gleboard.org>,
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	devicetree-compiler@...r.kernel.org,
	devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	devicetree-spec@...r.kernel.org,
	Hui Pu <hui.pu@...ealthcare.com>,
	Ian Ray <ian.ray@...ealthcare.com>,
	Luca Ceresoli <luca.ceresoli@...tlin.com>,
	Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
	Herve Codina <herve.codina@...tlin.com>
Subject: [RFC PATCH 45/77] dtc: Introduce dti_get_property_by_label()

The future introduction of orphan nodes for addons device-tree will lead
to more than one tree in the addons data. Those trees will be:
  - the classical root tree starting at the root node
  - trees related to orphan nodes

Also, an addon device-tree can have only trees based on orphan nodes. In
other words an addon device-tree is valid without having the classical
'root' tree.

To prepare this change, introduce and use dti_get_property_by_label().

dti_get_property_by_label() retrieves a property (and the related
node) by its label like get_property_by_label() but it works at the
struct dt_info level.

It handles the case where a 'root' device-tree is not present and will
handle orphan nodes trees as soon as they will be introduced.

This introduction doesn't lead to any functional changes.

Signed-off-by: Herve Codina <herve.codina@...tlin.com>
---
 checks.c   |  2 +-
 dtc.h      |  5 +++--
 livetree.c | 18 +++++++++++++++++-
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/checks.c b/checks.c
index 7dd5032..75040c0 100644
--- a/checks.c
+++ b/checks.c
@@ -447,7 +447,7 @@ static void check_duplicate_label(struct check *c, struct dt_info *dti,
 	othernode = dti_get_node_by_label(dti, label);
 
 	if (!othernode)
-		otherprop = get_property_by_label(dt, label, &othernode);
+		otherprop = dti_get_property_by_label(dti, label, &othernode);
 	if (!othernode)
 		othermark = get_marker_label(dt, label, &othernode,
 					       &otherprop);
diff --git a/dtc.h b/dtc.h
index f7b0b23..399e7fa 100644
--- a/dtc.h
+++ b/dtc.h
@@ -318,8 +318,6 @@ const char *get_unitname(struct node *node);
 struct property *get_property(struct node *node, const char *propname);
 cell_t propval_cell(struct property *prop);
 cell_t propval_cell_n(struct property *prop, unsigned int n);
-struct property *get_property_by_label(struct node *tree, const char *label,
-				       struct node **node);
 struct marker *get_marker_label(struct node *tree, const char *label,
 				struct node **node, struct property **prop);
 struct node *get_subnode(struct node *node, const char *nodename);
@@ -357,6 +355,9 @@ struct node *dti_get_node_by_label(struct dt_info *dti, const char *label);
 struct node *dti_get_node_by_phandle(struct dt_info *dti, cell_t phandle);
 struct node *dti_get_node_by_ref(struct dt_info *dti, const char *ref);
 cell_t dti_get_node_phandle(struct dt_info *dti, struct node *node);
+struct property *dti_get_property_by_label(struct dt_info *dti,
+					   const char *label,
+					   struct node **node);
 
 /* DTS version flags definitions */
 #define DTSF_V1		0x0001	/* /dts-v1/ */
diff --git a/livetree.c b/livetree.c
index a4917d1..d023075 100644
--- a/livetree.c
+++ b/livetree.c
@@ -594,7 +594,7 @@ cell_t propval_cell_n(struct property *prop, unsigned int n)
 	return fdt32_to_cpu(*((fdt32_t *)prop->val.val + n));
 }
 
-struct property *get_property_by_label(struct node *tree, const char *label,
+static struct property *get_property_by_label(struct node *tree, const char *label,
 				       struct node **node)
 {
 	struct property *prop;
@@ -837,6 +837,22 @@ struct node *dti_get_node_by_ref(struct dt_info *dti, const char *ref)
 	return NULL;
 }
 
+struct property *dti_get_property_by_label(struct dt_info *dti,
+					   const char *label,
+					   struct node **node)
+{
+	struct property *property;
+
+	if (dti->dt) {
+		property = get_property_by_label(dti->dt, label, node);
+		if (property)
+			return property;
+	}
+
+	*node = NULL;
+	return NULL;
+}
+
 static void add_phandle_property(struct node *node,
 				 const char *name, int format)
 {
-- 
2.52.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ