Re: [PATCH] pinctrl: starfive: jh7100: Reject malformed pin properties

From: Linus Walleij

Date: Tue Dec 01 2026 - 08:30:00 EST


On Wed, Nov 25, 2026 at 7:07 AM Zhiqi Zhang <zhiqizhangg@xxxxxxxxx> wrote:

> The JH7100 binding allows each pin group to specify either "pinmux" or
> "pins", but not both. starfive_dt_node_to_map() uses
> of_property_count_u32_elems() to decide which property is present, so a
> negative parser error is handled the same way as an absent property.
>
> A group that contains a malformed "pinmux" property and a valid "pins"
> property is therefore accepted as a "pins" group. Similarly, a malformed
> "pins" property can be ignored when a valid "pinmux" property is present.
> Both cases silently accept a device tree node that the binding rejects.
>
> Check property presence separately from array length. Reject groups that
> specify both or neither property, and require the selected property's u32
> array to contain at least one element before sizing and filling the maps.
>
> I found this issue. OpenAI Codex helped draft the fix, and I reviewed the
> result.
>
> Fixes: ec648f6b7686 ("pinctrl: starfive: Add pinctrl driver for StarFive SoCs")
> Signed-off-by: Zhiqi Zhang <zhiqizhangg@xxxxxxxxx>

Can one of the Starfive maintainers/authors review this patch?

Yours,
Linus Walleij