Re: [PATCH 1/1] of: properly check for error returned by fdt_get_name()

From: Frank Rowand
Date: Wed Apr 07 2021 - 17:04:41 EST


On 4/6/21 3:30 PM, Frank Rowand wrote:
> On 4/6/21 2:21 PM, Rob Herring wrote:
>> On Sun, Apr 04, 2021 at 10:28:45PM -0500, frowand.list@xxxxxxxxx wrote:
>>> From: Frank Rowand <frank.rowand@xxxxxxxx>
>>>
>>> fdt_get_name() returns error values via a parameter pointer
>>> instead of in function return. Fix check for this error value
>>> in populate_node() and callers of populate_node().
>>>
>>> Chasing up the caller tree showed callers of various functions
>>> failing to initialize the value of pointer parameters that
>>> can return error values. Initialize those values to NULL.
>>>
>>> The bug was introduced by
>>> commit e6a6928c3ea1 ("of/fdt: Convert FDT functions to use libfdt")
>>> but this patch can not be backported directly to that commit
>>> because the relevant code has further been restructured by
>>> commit dfbd4c6eff35 ("drivers/of: Split unflatten_dt_node()")
>>>
>>> The bug became visible by triggering a crash on openrisc with:
>>> commit 79edff12060f ("scripts/dtc: Update to upstream version v1.6.0-51-g183df9e9c2b9")
>>> as reported in:
>>> https://lore.kernel.org/lkml/20210327224116.69309-1-linux@xxxxxxxxxxxx/
>>>
>>> Fixes: commit 79edff12060f ("scripts/dtc: Update to upstream version v1.6.0-51-g183df9e9c2b9")
>>> Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx>
>>> Signed-off-by: Frank Rowand <frank.rowand@xxxxxxxx>
>>>
>>> ---
>>>
>>> This patch papers over the unaligned pointer passed to
>>> of_fdt_unflatten_tree() bug that Guenter reported in
>>> https://lore.kernel.org/lkml/20210327224116.69309-1-linux@xxxxxxxxxxxx/
>>>
>>> I will create a separate patch to fix that problem.
>
> Likely to be tomorrow (Wed 4/7).
>
> -Frank
>
>>
>> Got an ETA for that?
>>
>> Rob
>> .
>>
>

The patch to fix the alignment issue is:

https://lore.kernel.org/linux-devicetree/20210407205110.2173976-1-frowand.list@xxxxxxxxx/

Hopefully it will pass testing by Guenter.

Sorry about the previous vertical dyslexia response... :-)

-Frank