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-next>] [day] [month] [year] [list]
Message-Id: <20200225164540.4520-1-luca@lucaceresoli.net>
Date:   Tue, 25 Feb 2020 17:45:40 +0100
From:   Luca Ceresoli <luca@...aceresoli.net>
To:     devicetree@...r.kernel.org,
        Geert Uytterhoeven <geert+renesas@...der.be>
Cc:     Pantelis Antoniou <pantelis.antoniou@...sulko.com>,
        Frank Rowand <frowand.list@...il.com>,
        Rob Herring <robh+dt@...nel.org>, linux-kernel@...r.kernel.org,
        Luca Ceresoli <luca@...aceresoli.net>,
        Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: [PATCH v2] of: overlay: log the error cause on resolver failure

For some of its error paths, of_resolve_phandles() only logs a very generic
error which does not help much in finding the origin of the problem:

  OF: resolver: overlay phandle fixup failed: -22

Add error messages for all the error paths that don't have one. Now a
specific message is always emitted, thus also remove the generic catch-all
message emitted before returning.

For example, in case a DT overlay has a fixup node that is not present in
the base DT __symbols__, this error is now logged:

  OF: resolver: node gpio9 not found in base DT, fixup failed

Signed-off-by: Luca Ceresoli <luca@...aceresoli.net>
Cc: Geert Uytterhoeven <geert@...ux-m68k.org>
---

I don't know in detail the meaning of the adjust_local_phandle_references()
and update_usages_of_a_phandle_reference() error paths, thus I have put
pretty generic messages. Any suggestion on better wording would be welcome.

Changed in v2:

 - add a message for each error path that does not have one yet
---
 drivers/of/resolver.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
index 83c766233181..a80d673621bc 100644
--- a/drivers/of/resolver.c
+++ b/drivers/of/resolver.c
@@ -291,8 +291,10 @@ int of_resolve_phandles(struct device_node *overlay)
 			break;
 
 	err = adjust_local_phandle_references(local_fixups, overlay, phandle_delta);
-	if (err)
+	if (err) {
+		pr_err("cannot adjust local phandle references\n");
 		goto out;
+	}
 
 	overlay_fixups = NULL;
 
@@ -321,11 +323,15 @@ int of_resolve_phandles(struct device_node *overlay)
 
 		err = of_property_read_string(tree_symbols,
 				prop->name, &refpath);
-		if (err)
+		if (err) {
+			pr_err("node %s not found in base DT, fixup failed\n",
+			       prop->name);
 			goto out;
+		}
 
 		refnode = of_find_node_by_path(refpath);
 		if (!refnode) {
+			pr_err("cannot find node for %s\n", refpath);
 			err = -ENOENT;
 			goto out;
 		}
@@ -334,13 +340,14 @@ int of_resolve_phandles(struct device_node *overlay)
 		of_node_put(refnode);
 
 		err = update_usages_of_a_phandle_reference(overlay, prop, phandle);
-		if (err)
+		if (err) {
+			pr_err("cannot update usages of a phandle reference (%s)\n",
+				prop->name);
 			break;
+		}
 	}
 
 out:
-	if (err)
-		pr_err("overlay phandle fixup failed: %d\n", err);
 	of_node_put(tree_symbols);
 
 	return err;
-- 
2.25.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ