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: <20251112143520.233870-2-yuntao.wang@linux.dev>
Date: Wed, 12 Nov 2025 22:35:11 +0800
From: Yuntao Wang <yuntao.wang@...ux.dev>
To: Rob Herring <robh@...nel.org>,
	Saravana Kannan <saravanak@...gle.com>
Cc: Geert Uytterhoeven <geert+renesas@...der.be>,
	Catalin Marinas <catalin.marinas@....com>,
	AKASHI Takahiro <takahiro.akashi@...aro.org>,
	James Morse <james.morse@....com>,
	Chen Zhou <chenzhou10@...wei.com>,
	Baoquan He <bhe@...hat.com>,
	Zhen Lei <thunder.leizhen@...wei.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Changyuan Lyu <changyuanl@...gle.com>,
	Alexander Graf <graf@...zon.com>,
	"Mike Rapoport (Microsoft)" <rppt@...nel.org>,
	devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Yuntao Wang <yuntao.wang@...ux.dev>
Subject: [PATCH 01/10] of/fdt: Introduce dt_root_addr_size_cells() and dt_root_addr_size_bytes()

Currently, many places use the result of the expression
`(dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32)` for various
checks.

To improve code maintainability and reduce the chance of errors, extract
this expression into two helper functions.

Signed-off-by: Yuntao Wang <yuntao.wang@...ux.dev>
---
 include/linux/of_fdt.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index b8d6c0c20876..9ce2433865ae 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -30,6 +30,17 @@ extern void *of_fdt_unflatten_tree(const unsigned long *blob,
 /* TBD: Temporary export of fdt globals - remove when code fully merged */
 extern int __initdata dt_root_addr_cells;
 extern int __initdata dt_root_size_cells;
+
+static inline int dt_root_addr_size_cells(void)
+{
+	return dt_root_addr_cells + dt_root_size_cells;
+}
+
+static inline int dt_root_addr_size_bytes(void)
+{
+	return dt_root_addr_size_cells() * sizeof(__be32);
+}
+
 extern void *initial_boot_params;
 extern phys_addr_t initial_boot_params_pa;
 
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ