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: <20260115091839.8206-1-bartosz.golaszewski@oss.qualcomm.com>
Date: Thu, 15 Jan 2026 10:18:39 +0100
From: Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
To: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...nel.org>
Cc: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
Subject: [PATCH] of: guard pointers to key OF nodes with an #ifdef

We declare the pointers to some key OF-nodes unconditionally in
linux/of.h but only export them with CONFIG_OF=y. If anyone uses them in
code built without devicetree support enabled, the problem will only come
to light at link-time. Add an #ifdef guard to catch it at compile-time.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
---
 include/linux/of.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/of.h b/include/linux/of.h
index 9bbdcf25a2b4..bc57dff819f8 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -138,10 +138,12 @@ static inline void of_node_put(struct device_node *node) { }
 DEFINE_FREE(device_node, struct device_node *, if (_T) of_node_put(_T))
 
 /* Pointer for first entry in chain of all nodes. */
+#if IS_ENABLED(CONFIG_OF)
 extern struct device_node *of_root;
 extern struct device_node *of_chosen;
 extern struct device_node *of_aliases;
 extern struct device_node *of_stdout;
+#endif
 
 /*
  * struct device_node flag descriptions
-- 
2.47.3


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ