All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: conor+dt@kernel.org, linux-hwmon@vger.kernel.org,
	robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 1/3] dt-bindings: hwmon: Document SMSC EMC1402/1403/1404/1428
Date: Fri, 31 Jul 2026 11:42:55 +0000	[thread overview]
Message-ID: <20260731114255.E175D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260731113007.145322-2-clamor95@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Schema Constraint Bypass via incorrect `items` nesting for `reg` property bounds
--

--- Patch [1]: [PATCH v4 1/3] dt-bindings: hwmon: Document SMSC EMC1402/1403/1404/1428 ---
commit 370ec6fbb759eebe7152f9544892c617f0745163
Author: Svyatoslav Ryhel <clamor95@gmail.com>

dt-bindings: hwmon: Document SMSC EMC1402/1403/1404/1428

This commit documents the basic hardware layout of SMSC (now Microchip)
EMC1402/1403/1404/1428 thermal sensors and introduces a new YAML device tree
binding schema.

> diff --git a/Documentation/devicetree/bindings/hwmon/smsc,emc1403.yaml b/Documentation/devicetree/bindings/hwmon/smsc,emc1403.yaml
> new file mode 100644
> index 0000000000000..d7873a37c3295
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/smsc,emc1403.yaml
> @@ -0,0 +1,203 @@

[ ... ]

> +patternProperties:
> +  "^channel@([0-7])$":
> +    type: object
> +    description: Represents channels of the device and their specific configuration.
> +
> +    properties:
> +      reg:
> +        description: The channel number. 0 is local channel, 1-7 are remote channels.
> +        items:
> +          minimum: 0
> +          maximum: 7

[Severity: Medium]
Does nesting the minimum/maximum bounds inside items for the reg property bypass
dt-schema validation?

Since dt-schema decodes reg into an array of regions, numeric bounds placed
under items like this apply to the array element itself and are ignored.
Could these bounds be specified differently so they are correctly enforced
during make dtbs_check?

[ ... ]

> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - smsc,emc1402
> +    then:
> +      patternProperties:
> +        "^channel@([0-7])$":
> +          properties:
> +            reg:
> +              items:
> +                maximum: 1

[Severity: Medium]
Will this stricter bound also be ignored during schema validation due to the
items nesting? 

This could allow an invalid device tree, such as one defining channel@5 for
smsc,emc1402, to silently pass validation checks.

[ ... ]

> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - smsc,emc1403
> +    then:
> +      patternProperties:
> +        "^channel@([0-7])$":
> +          properties:
> +            reg:
> +              items:
> +                maximum: 2

[Severity: Medium]
Does this maximum bound for smsc,emc1403 suffer from the same nesting issue?

[ ... ]

> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - smsc,emc1404
> +    then:
> +      patternProperties:
> +        "^channel@([0-7])$":
> +          properties:
> +            reg:
> +              items:
> +                maximum: 3

[Severity: Medium]
Does the maximum bound for smsc,emc1404 also need to be adjusted to avoid
being ignored by dt-schema?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260731113007.145322-1-clamor95@gmail.com?part=1

  reply	other threads:[~2026-07-31 11:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 11:30 [PATCH v4 0/3] hwmon: emc1403: Convert to use OF bindings and add regulator support Svyatoslav Ryhel
2026-07-31 11:30 ` [PATCH v4 1/3] dt-bindings: hwmon: Document SMSC EMC1402/1403/1404/1428 Svyatoslav Ryhel
2026-07-31 11:42   ` sashiko-bot [this message]
2026-07-31 11:30 ` [PATCH v4 2/3] hwmon: (emc1403) Convert to use OF bindings Svyatoslav Ryhel
2026-07-31 11:41   ` sashiko-bot
2026-07-31 11:30 ` [PATCH v4 3/3] hwmon: (emc1403) Add regulator support Svyatoslav Ryhel
2026-07-31 11:37   ` sashiko-bot

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=20260731114255.E175D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --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.