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: <tencent_FFC8E7A5A76050982D28F811C81F936D9205@qq.com>
Date: Tue, 15 Apr 2025 22:10:40 +0800
From: Liya Huang <1425075683@...com>
To: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>
Cc: Marek Szyprowski <m.szyprowski@...sung.com>, devicetree@...r.kernel.org, 
 linux-kernel@...r.kernel.org, Liya Huang <1425075683@...com>
Subject: [PATCH] of: reserved-mem: Warn for missing initfn in
 __reservedmem_of_table

For the data in __reservedmem_of_table, its function pointer initfn might
be NULL. However, __reserved_mem_init_node() only considers non-NULL cases
and ignores NULL function pointers.

Therefore, a check for the possibility of initfn being NULL has been added
here, along with skipping the initfn() and issuing a warning.

To: Rob Herring <robh@...nel.org>
To: Saravana Kannan <saravanak@...gle.com>
Cc: Marek Szyprowski <m.szyprowski@...sung.com>
Cc: devicetree@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Liya Huang <1425075683@...com>
---
For the data in __reservedmem_of_table, its function pointer initfn might 
be NULL. However, __reserved_mem_init_node() only considers non-NULL cases
and ignores NULL function pointers.

Therefore, a check for the possibility of initfn being NULL has been added
here, along with skipping the initfn() and issuing a warning.
---
 drivers/of/of_reserved_mem.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index ee2e31522d7ef69d816127a9003c423d5fb4023d..0a7cc599c0ca68001b2395759310f3585f247db9 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -496,6 +496,11 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
 		if (!of_flat_dt_is_compatible(rmem->fdt_node, compat))
 			continue;
 
+		if (!initfn) {
+			pr_warn("no init function for %s\n", rmem->name);
+			continue;
+		}
+
 		ret = initfn(rmem);
 		if (ret == 0) {
 			pr_info("initialized node %s, compatible id %s\n",

---
base-commit: 8ffd015db85fea3e15a77027fda6c02ced4d2444
change-id: 20250415-__reserved_mem_init_node-689cbe9d54c4

Best regards,
-- 
Liya Huang <1425075683@...com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ