[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <06b98b91-e795-4b74-aed7-ae4a65560353@icloud.com>
Date: Sat, 11 Jan 2025 08:40:27 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Rob Herring <robh@...nel.org>
Cc: 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>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH v4 07/14] of: property: Fix potential fwnode reference's
argument count got out of range
On 2025/1/11 04:35, Rob Herring wrote:
> On Thu, Jan 09, 2025 at 09:26:58PM +0800, Zijun Hu wrote:
>> From: Zijun Hu <quic_zijuhu@...cinc.com>
>>
>> Currently, the maximal fwnode reference argument count supported is
>> 8, and the maximal OF node phandle argument count supported is 16, but
>> of_fwnode_get_reference_args() directly assigns OF node phandle count
>> @of_args.args_count to fwnode reference count @args->nargs, so may cause
>> fwnode reference argument count got is out of range, namely, in [9, 16].
>>
>> Fix by truncating @args->nargs got to 8 and warning if it > 8.
>>
>> Fixes: b66548e2a9ba ("of: Increase MAX_PHANDLE_ARGS")
> No, it would have been 3e3119d3088f ("device property: Introduce
> fwnode_property_get_reference_args").
>
agree.
> Why don't we increase NR_FWNODE_REFERENCE_ARGS or rework things such
> that MAX_PHANDLE_ARGS and NR_FWNODE_REFERENCE_ARGS can't disagree?
that may involve ACPI and not sure if there are risk.
the commit you mentioned above have below commit message:
"The semantics is slightly different: the cells property is ignored on
ACPI as the number of arguments can be explicitly obtained from the
firmware interface"
let me do more investigation (^^).
perhaps, various firmware(DT|APCI|SWNODE...) may use
NR_FWNODE_REFERENCE_ARGS instead defining a MACRO such as
MAX_PHANDLE_ARGS separately.
>
>> Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
>> ---
>> drivers/of/property.c | 5 +++++
>> 1 file changed, 5 insertions(+)
Powered by blists - more mailing lists