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: <20250225143844.GA2279028-robh@kernel.org>
Date: Tue, 25 Feb 2025 08:38:44 -0600
From: Rob Herring <robh@...nel.org>
To: Zijun Hu <zijun_hu@...oud.com>
Cc: Saravana Kannan <saravanak@...gle.com>, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH 3/5] of: Correct property name comparison in
 __of_add_property()

On Mon, Feb 24, 2025 at 10:27:59PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@...cinc.com>
> 
> __of_add_property() compares property name by strcmp(), and that is
> improper for SPARC which wants strcasecmp().

Except that 'name' is the nodename (usually, with a few rare 
exceptions). Sparc node names are case sensitive, so strcmp was correct. 

My hope is to get rid of case insensitive comparisions, so if nothing 
cares that we're doing a case sensitive comparision, I want to keep 
that. 

I also want to get rid of storing both 'name' as a property and 
device_node.name. The name property is an ABI issue though if no one is 
looking, then it's not an ABI issue. Also, we should be able to generate 
device_node.name from device_node.full_name. There's still a bunch of 
direct users of device_node.name which have to be fixed. Mostly in clock 
drivers from what I remember.

> Fix by using dedicated property name comparison macro of_prop_cmp().
> 
> Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
> ---
>  drivers/of/base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 001ff6ce4abf85c07f13649d5a9f691f549a8ccc..c810014957e81171675b63f25eaabe391cc903e4 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1651,7 +1651,7 @@ int __of_add_property(struct device_node *np, struct property *prop)
>  	prop->next = NULL;
>  	next = &np->properties;
>  	while (*next) {
> -		if (strcmp(prop->name, (*next)->name) == 0) {
> +		if (of_prop_cmp(prop->name, (*next)->name) == 0) {
>  			/* duplicate ! don't insert it */
>  			rc = -EEXIST;
>  			goto out_unlock;
> 
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ