[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e6faab90-b4f3-4c73-b486-2e44d15d22a2@icloud.com>
Date: Tue, 25 Feb 2025 23:04:55 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Rob Herring <robh@...nel.org>
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 2025/2/25 22:38, Rob Herring wrote:
> 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.
Here, it is property's name and NOT node's name.
arch/sparc/include/asm/prom.h:
#define of_compat_cmp(s1, s2, l) strncmp((s1), (s2), (l))
#define of_prop_cmp(s1, s2) strcasecmp((s1), (s2)) //SPARC HERE
#define of_node_cmp(s1, s2) strcmp((s1), (s2))
include/linux/of.h:
/* Default string compare functions, Allow arch asm/prom.h to override */
#if !defined(of_compat_cmp)
#define of_compat_cmp(s1, s2, l) strcasecmp((s1), (s2))
#define of_prop_cmp(s1, s2) strcmp((s1), (s2)) // others HERE
#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
#endif
actually, later __of_update_property() and __of_find_property() use
of_prop_cmp() instead of strcmp() to compare property name.
perhaps, compatible and node name also have similar issues in current
OF codes.
Powered by blists - more mailing lists