Devicetree
 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 v6 03/10] dtc: dt-check-style: Fix alignment of values in continued property lines
Date: Wed, 26 Aug 2026 11:23:42 +0000	[thread overview]
Message-ID: <20260826112342.7BF861F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260826-n-dts-style-checker-continued-v6-3-f270b1e81f8e@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incorrect continuation alignment target column calculation when block comments precede the first '<' or '"'.
--

commit 88a2bc80735f633fd569467a745101b91a3872d0
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

dtc: dt-check-style: Fix alignment of values in continued property lines

This patch updates dt-check-style to check alignment of continued property
values to inner values if they are part of a previous phandle. It ignores
comments and trailing whitespace when determining the continuation alignment
target column.

> diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> index 22e1ceac7f8b7..eb5045f0ad9e4 100755
> --- a/scripts/dtc/dt-check-style
> +++ b/scripts/dtc/dt-check-style

[ ... ]

> @@ -938,17 +939,26 @@ def check_continuation_alignment(ctx):
>          eq = dl.raw.find('=')
>          if eq < 0:
>              continue
> -        # First '<' or '"' after '='
> -        rest = dl.raw[eq + 1:]
> -        m = re.search(r'[<"]', rest)
> +        # First '<' or '"' after '=', but ignore comments and strip trailing
> +        # whitespace (e.g. remaining after removing the comment)
> +        rest = _strip_strings_and_comments(dl.raw[eq + 1:]).rstrip()
> +        m = re.search(r'\s*([<"])', rest)
>          if not m:
>              continue
> -        target_col = _display_col(dl.raw[:eq + 1 + m.start()])
> +        dl_value_complete = rest.endswith('",') or rest.endswith('>,')
> +        target_col = _display_col(_strip_strings_and_comments(dl.raw[:eq + 1 + m.start(1)]))

[Severity: Medium]
Will this calculate an incorrect target column if a block comment precedes
the first '<' or '"'?

In check_continuation_alignment(), m.start(1) provides an index derived
from rest, which has had comments stripped via _strip_strings_and_comments(). 
However, it is then used to slice dl.raw, which is the original unstripped 
string. 

If a device tree property assignment contains a block comment between the 
'=' sign and the first '<' or '"' (for example: reg = /* comment */ <...>), 
the m.start(1) index will be too small. This will prematurely truncate 
dl.raw during the slice (often in the middle of the comment), causing 
_display_col() to evaluate a much smaller target column than expected. 

This can lead to false positive warnings for correctly aligned property
continuations.

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260826-n-dts-style-checker-continued-v6-0-f270b1e81f8e@oss.qualcomm.com?part=3

  reply	other threads:[~2026-08-26 11:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 11:15 [PATCH v6 00/10] dtc: dt-check-style: Improvements for false positives Krzysztof Kozlowski
2026-08-26 11:15 ` [PATCH v6 01/10] dtc: dt-check-style: Handle sorting of top-level nodes and properties Krzysztof Kozlowski
2026-08-26 11:26   ` sashiko-bot
2026-08-26 11:15 ` [PATCH v6 02/10] dtc: dt-check-style: Drop stray backslash before quote for continuation-alignment Krzysztof Kozlowski
2026-08-26 11:15 ` [PATCH v6 03/10] dtc: dt-check-style: Fix alignment of values in continued property lines Krzysztof Kozlowski
2026-08-26 11:23   ` sashiko-bot [this message]
2026-08-26 11:15 ` [PATCH v6 04/10] dtc: dt-check-style: Consistently call 'kind' as 'file_type' Krzysztof Kozlowski
2026-08-26 11:15 ` [PATCH v6 05/10] dtc: dt-check-style: Introduce 'stricter' mode Krzysztof Kozlowski
2026-08-26 11:15 ` [PATCH v6 06/10] dtc: dt-check-style: Replace Test User email with Rob Herring Krzysztof Kozlowski
2026-08-26 11:15 ` [PATCH v6 07/10] dtc: dt-check-style: Call _strip_strings_and_comments() only once Krzysztof Kozlowski
2026-08-26 11:16 ` [PATCH v6 08/10] dtc: dt-check-style: Add test for trailing white-space in DTS Krzysztof Kozlowski
2026-08-26 11:16 ` [PATCH v6 09/10] dtc: dt-check-style: Add warning for redundant white-spaces Krzysztof Kozlowski
2026-08-26 11:16 ` [PATCH v6 10/10] MAINTAINERS: dt-bindings: Include dt-check-style in DT binding entry Krzysztof Kozlowski
2026-08-26 15:20 ` [PATCH v6 00/10] dtc: dt-check-style: Improvements for false positives Rob Herring

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=20260826112342.7BF861F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox