lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 12 Dec 2022 10:51:47 -0600
From:   Rob Herring <robh@...nel.org>
To:     Arınç ÜNAL <arinc.unal@...nc9.com>
Cc:     Colin Foster <colin.foster@...advantage.com>,
        linux-renesas-soc@...r.kernel.org,
        linux-mediatek@...ts.infradead.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org, netdev@...r.kernel.org,
        John Crispin <john@...ozen.org>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Claudiu Manoil <claudiu.manoil@....com>,
        Marek Vasut <marex@...x.de>,
        Sean Wang <sean.wang@...iatek.com>,
        DENG Qingfang <dqfext@...il.com>,
        Landen Chao <Landen.Chao@...iatek.com>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Clément Léger <clement.leger@...tlin.com>,
        Alvin Šipraga <alsi@...g-olufsen.dk>,
        Linus Walleij <linus.walleij@...aro.org>,
        UNGLinuxDriver@...rochip.com,
        Woojung Huh <woojung.huh@...rochip.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Kurt Kanzenbach <kurt@...utronix.de>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        "David S. Miller" <davem@...emloft.net>,
        Vladimir Oltean <olteanv@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        George McCollister <george.mccollister@...il.com>
Subject: Re: [PATCH v5 net-next 04/10] dt-bindings: net: dsa: utilize base
 definitions for standard dsa switches

On Mon, Dec 12, 2022 at 12:28:06PM +0300, Arınç ÜNAL wrote:
> On 10.12.2022 21:02, Colin Foster wrote:
> > Hi Arınç,
> > On Sat, Dec 10, 2022 at 07:24:42PM +0300, Arınç ÜNAL wrote:
> > > On 10.12.2022 06:30, Colin Foster wrote:
> > > > DSA a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > > > +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > > > @@ -58,4 +58,26 @@ oneOf:
> > > >    additionalProperties: true
> > > > +$defs:
> > > > +  ethernet-ports:
> > > > +    description: A DSA switch without any extra port properties
> > > > +    $ref: '#/'
> > > > +
> > > > +    patternProperties:
> > > > +      "^(ethernet-)?ports$":
> > > > +        type: object
> > > > +        additionalProperties: false
> > > > +
> > > > +        properties:
> > > > +          '#address-cells':
> > > > +            const: 1
> > > > +          '#size-cells':
> > > > +            const: 0
> > > > +
> > > > +        patternProperties:
> > > > +          "^(ethernet-)?port@[0-9]+$":
> > > > +            description: Ethernet switch ports
> > > > +            $ref: dsa-port.yaml#
> > > > +            unevaluatedProperties: false
> > > 
> > > I've got moderate experience in json-schema but shouldn't you put 'type:
> > > object' here like you did for "^(ethernet-)?ports$"?
> > 
> > I can't say for sure, but adding "type: object" here and removing it
> > from mediatek,mt7530.yaml still causes the same issue I mention below.
> > 
> > Rob's initial suggestion for this patch set (which was basically the
> > entire implementation... many thanks again Rob) can be found here:
> > https://lore.kernel.org/netdev/20221104200212.GA2315642-robh@kernel.org/
> > 
> >  From what I can tell, the omission of "type: object" here was
> > intentional. At the very least, it doesn't seem to have any effect on
> > warnings.
> > 
> > > 
> > > > +
> > > >    ...
> > > > diff --git a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
> > > > index 73b774eadd0b..748ef9983ce2 100644
> > > > --- a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
> > > > +++ b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
> > > > @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
> > > >    title: Hirschmann Hellcreek TSN Switch Device Tree Bindings
> > > >    allOf:
> > > > -  - $ref: dsa.yaml#
> > > > +  - $ref: dsa.yaml#/$defs/ethernet-ports
> > > >    maintainers:
> > > >      - Andrew Lunn <andrew@...n.ch>
> > > > diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > > > index f2e9ff3f580b..20312f5d1944 100644
> > > > --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > > > +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > > > @@ -157,9 +157,6 @@ patternProperties:
> > > >        patternProperties:
> > > >          "^(ethernet-)?port@[0-9]+$":
> > > >            type: object
> > > 
> > > This line was being removed on the previous version. Must be related to
> > > above.
> > 
> > Without the 'object' type here, I get the following warning:
> > 
> > Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: patternProperties:^(ethernet-)?ports$:patternProperties:^(ethernet-)?port@[0-9]+$: 'anyOf' conditional failed, one must be fixed:
> >          'type' is a required property
> >          '$ref' is a required property
> >          hint: node schemas must have a type or $ref
> >          from schema $id: http://devicetree.org/meta-schemas/core.yaml#
> > ./Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/net/dsa/mediatek,mt7530.yaml
> >    SCHEMA  Documentation/devicetree/bindings/processed-schema.json
> > /home/colin/src/work/linux_vsc/linux-imx/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: ignoring, error in schema: patternProperties: ^(ethernet-)?ports$: patternProperties: ^(ethernet-)?port@[0-9]+$

Is the above warning not clear? We require either 'type' or a $ref to 
define nodes as json-schema objects.


> > I'm testing this now and I'm noticing something is going on with the
> > "ref: dsa-port.yaml"
> > 
> > 
> > Everything seems to work fine (in that I don't see any warnings) when I
> > have this diff:
> > 
> > 
> > diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > index 20312f5d1944..db0122020f98 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yam
> > @@ -156,8 +156,7 @@ patternProperties:
> > 
> >       patternProperties:
> >         "^(ethernet-)?port@[0-9]+$":
> > -        type: object
> > -
> > +        $ref: dsa-port.yaml#
> >           properties:
> >             reg:
> >               description:
> > @@ -165,7 +164,6 @@ patternProperties:
> >                 for user ports.
> > 
> >           allOf:
> > -          - $ref: dsa-port.yaml#
> >             - if:
> >                 required: [ ethernet ]
> >               then:
> > 
> > 
> > 
> > This one has me [still] scratching my head...
> 
> Right there with you. In addition to this, having or deleting type object
> on/from "^(ethernet-)?ports$" and "^(ethernet-)?port@[0-9]+$" on dsa.yaml
> doesn't cause any warnings (checked with make dt_binding_check
> DT_SCHEMA_FILES=net/dsa) which makes me question why it's there in the first
> place.


That check probably doesn't consider an ref being under an 'allOf'. 
Perhaps what is missing in understanding is every schema at the 
top-level has an implicit 'type: object'. But nothing is ever implicit 
in json-schema which will silently ignore keywords which don't make 
sense for an instance type. Instead of a bunch of boilerplate, the 
processed schema has 'type' added in lots of cases such as this one.

Rob

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ