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] [day] [month] [year] [list]
Message-Id: <20250109-of_core_fix-v4-14-db8a72415b8c@quicinc.com>
Date: Thu, 09 Jan 2025 21:27:05 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>, 
 Maxime Ripard <mripard@...nel.org>, Robin Murphy <robin.murphy@....com>, 
 Grant Likely <grant.likely@...retlab.ca>, Marc Zyngier <maz@...nel.org>, 
 Andreas Herrmann <andreas.herrmann@...xeda.com>, 
 Marek Szyprowski <m.szyprowski@...sung.com>, 
 Catalin Marinas <catalin.marinas@....com>, Mike Rapoport <rppt@...nel.org>, 
 Oreoluwa Babatunde <quic_obabatun@...cinc.com>
Cc: Zijun Hu <zijun_hu@...oud.com>, devicetree@...r.kernel.org, 
 linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: [PATCH v4 14/14] of: Improve __of_add_property_sysfs() readability

From: Zijun Hu <quic_zijuhu@...cinc.com>

__of_add_property_sysfs() hard codes string "security-" length as 9, but
that is not obvious for readers.

Improve its readability by using strlen().

Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
 drivers/of/kobj.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c
index aa887166f0d21030d620d43c864ca76cde1c6d05..44bfe50c6ea6503e3940578de1dfc7fe0583dfb3 100644
--- a/drivers/of/kobj.c
+++ b/drivers/of/kobj.c
@@ -62,10 +62,11 @@ static const char *safe_name(const struct kobject *kobj, const char *orig_name)
 
 int __of_add_property_sysfs(struct device_node *np, struct property *pp)
 {
+	const char *security_prefix = "security-";
 	int rc;
 
 	/* Important: Don't leak passwords */
-	bool secure = strncmp(pp->name, "security-", 9) == 0;
+	bool secure = strncmp(pp->name, security_prefix, strlen(security_prefix)) == 0;
 
 	if (!IS_ENABLED(CONFIG_SYSFS))
 		return 0;

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ