All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 03/11] dtc: dt-check-style: Handle root node in overlays
Date: Sun, 02 Aug 2026 09:01:57 +0000	[thread overview]
Message-ID: <20260802090158.577821F00AC4@smtp.kernel.org> (raw)
In-Reply-To: <20260802-n-dts-style-checker-continued-v2-3-6c5dbd1ccfe4@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch has a meaningful code and commit message mismatch and introduces flawed parsing logic. It claims to fix property order checks for root nodes in overlays, but only modifies child name ordering logic. Furthermore, the new string-matching logic for `is_root` is brittle (causing valid root nodes with labels or extra spaces to bypass exclusion logic) and completely redundant for its intended target `&{/} {`.
--

--- Patch [3]: [PATCH v2 03/11] dtc: dt-check-style: Handle root node in overlays ---
commit caf9c0103adaa0c528c36d5ac2f2a91738b7dbea
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

dtc: dt-check-style: Handle root node in overlays

Detection of overriding/extending a root node is updated to check for
expected syntax before creating DtsLine and store it as an 'is_root'
attribute to fix false positives for root nodes in overlays.

> This fixes false positives for property order for root nodes in overlays.

[Severity: Medium]
The commit message mentions fixing "property order", but the code modifies
check_child_name_order(). Is this a typo in the commit message, or was
check_property_order() intended to be modified instead?

> diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> index 96deffc0d8a7c..1937c6feb57ec 100755
> --- a/scripts/dtc/dt-check-style
> +++ b/scripts/dtc/dt-check-style
[ ... ]
> @@ -228,7 +229,10 @@ def classify_lines(text):
>              continue
>  
>          if code.endswith('{'):
> -            dl = DtsLine(i, raw, LineType.NODE_OPEN, depth, indent_str, code)
> +            is_root = False
> +            if code == '&{/} {' or code == '/ {':
> +                is_root = True

[Severity: Medium]
Can this strict string comparison fail for valid root nodes?

For example, if a root node has a label like "label: / {" or contains extra
spaces like "/  {", is_root would evaluate to False. Since
"c.node_name in (None, '/')" is removed later in the patch, would these
valid nodes bypass the exclusion logic and be improperly evaluated for
child name ordering?

> +            dl = DtsLine(i, raw, LineType.NODE_OPEN, depth, indent_str, code, is_root=is_root)
>              parse_node_header(dl)
>              out.append(dl)
>              depth += 1
[ ... ]
> @@ -550,7 +554,9 @@ def check_child_name_order(ctx):
>          for c in children:
>              if c.node_addr is not None:
>                  continue
> -            if c.node_name in (None, '/'):
> +            if c.node_name is None:
> +                continue
> +            if c.is_root:
>                  continue

[Severity: Medium]
Is the c.is_root check redundant for "&{/} {" nodes?

Because "&{/} {" fails to match the regular expression in parse_node_header(),
its node_name evaluates to None. This means it would already be skipped by
the preceding "if c.node_name is None: continue" check.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260802-n-dts-style-checker-continued-v2-0-6c5dbd1ccfe4@oss.qualcomm.com?part=3

  reply	other threads:[~2026-08-02  9:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-02  8:45 [PATCH v2 00/11] dtc: dt-check-style: Improvements for false positives Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 01/11] dtc: dt-check-style: Add missing /dts-v1/ to few test cases Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 02/11] dtc: dt-check-style: Simplify setting depth of DtsLine Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 03/11] dtc: dt-check-style: Handle root node in overlays Krzysztof Kozlowski
2026-08-02  9:01   ` sashiko-bot [this message]
2026-08-02 12:13     ` Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 04/11] dtc: dt-check-style: Handle sorting of top-level nodes and properties Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 05/11] dtc: dt-check-style: Drop stray backslash before quote for continuation-alignment Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 06/11] dtc: dt-check-style: Fix alignment of values in continued property lines Krzysztof Kozlowski
2026-08-02  8:56   ` sashiko-bot
2026-08-02 12:20     ` Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 07/11] dtc: dt-check-style: Consistently call 'kind' as 'file_type' Krzysztof Kozlowski
2026-08-02  8:54   ` sashiko-bot
2026-08-02 12:22     ` Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 08/11] dtc: dt-check-style: Introduce 'stricter' mode Krzysztof Kozlowski
2026-08-02  9:06   ` sashiko-bot
2026-08-02 10:50     ` Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 09/11] dtc: dt-check-style: Add test for trailing white-space in DTS Krzysztof Kozlowski
2026-08-02  8:51   ` sashiko-bot
2026-08-02 12:23     ` Krzysztof Kozlowski
2026-08-02  8:45 ` [PATCH v2 10/11] dtc: dt-check-style: Add warning for redundant white-spaces Krzysztof Kozlowski
2026-08-02  8:54   ` sashiko-bot
2026-08-02  8:45 ` [PATCH v2 11/11] MAINTAINERS: dt-bindings: Include dt-check-style in DT binding entry Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260802090158.577821F00AC4@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.