Re: [PATCH v3 08/11] dtc: dt-check-style: Introduce 'stricter' mode

[email protected]
Newsgroups org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Top-level nodes with the same name but different unit addresses are no longer validated for correct ordering.
--

--- Patch [8]: [PATCH v3 08/11] dtc: dt-check-style: Introduce 'stricter' mode ---
commit 3fa51567db6be5159b622c7ba7a9c229f630ccc8
Author: Krzysztof Kozlowski <[email protected]>

dtc: dt-check-style: Introduce 'stricter' mode
    
This commit introduces a 'stricter' mode to the dt-check-style script. It
moves the line-length and unused-labels rules for DTS files from 'strict' to
'stricter' to reduce false positives.

> diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> index e3adaad1be633..1430c675bd951 100755
> --- a/scripts/dtc/dt-check-style
> +++ b/scripts/dtc/dt-check-style
> @@ -5,12 +5,14 @@
>  # .dts/.dtsi/.dtso source files. Enforces rules from
>  # Documentation/devicetree/bindings/dts-coding-style.rst.

[ ... ]

[Severity: Medium]
Are top-level nodes with the same name but different unit addresses still
validated for correct ordering?

Looking at check_child_name_order() in scripts/dtc/dt-check-style, top-level
addressed nodes are mapped solely to their node_name, completely discarding
their unit address as a secondary sorting key:

scripts/dtc/dt-check-style:check_child_name_order() {
    ...
    unaddressed.append((_natural_sort_key(c.node_name), c))
    ...
}

Because the strict less-than comparison against identically evaluated name keys
evaluates to False, the script silently ignores out-of-order nodes with the
same name:

scripts/dtc/dt-check-style:check_child_name_order() {
    ...
    for i in range(1, len(unaddressed)):
        if unaddressed[i][0] < unaddressed[i - 1][0]:
    ...
}

Does this allow malformed DTS files with out-of-order top-level nodes of the
same name to bypass validation?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260803-n-dts-style-checker-continued-v3-0-6c9776928cea@oss.qualcomm.com?part=8
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.