mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: Taylor Bates <tmbates12@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	 "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	 Paolo Abeni <pabeni@redhat.com>,
	 Simon Horman <horms@kernel.org>,  Jiri Pirko <jiri@resnulli.us>,
	 Stanislav Fomichev <sdf@fomichev.me>,
	netdev@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2] netlink: specs: fix duplicate if/then keys in netlink-raw schema
Date: Thu, 17 Sep 2026 09:35:07 +0100	[thread overview]
Message-ID: <m2ecesp96s.fsf@gmail.com> (raw)
In-Reply-To: <20260914-ynl-robustness-v2-1-c6125003b21e@gmail.com>

Taylor Bates <tmbates12@gmail.com> writes:

> Currently netlink-raw.yaml contains two if keys and two then keys in a
> single mapping that enforces a "len" for "pad" members and a "len" or
> "struct" for binary members.
>
> During validation PyYAML resolves duplicate keys last-wins, so only the
> binary rule survives. Pad has not been validated since commit
> bf08f32c8ced ("tools/net/ynl: Add support for nested structs") added
> the second if/then pair in January 2024.
>
> None of the current specs violate this rule, but this validation should
> not be parser dependent and unspecified. Strict YAML validators such as
> Red Hat's VS Code YAML extension and Adrien Verge's yamllint will
> reject the netlink-raw.yaml schema:
>
> Command:
>   $ yamllint Documentation/netlink/netlink-raw.yaml
>
> Output:
>   185:13    error    duplication of key "if" in mapping  (key-duplicates)
>   189:13    error    duplication of key "then" in mapping  (key-duplicates)
>
> The following invalid netlink family spec will pass validation in the
> current ynl tooling:
>
>   # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
>   ---
>   name: minimal-raw
>   doc: Minimal netlink-raw family for schema validation testing.
>   protocol: netlink-raw
>   protonum: 0
>
>   definitions:
>     -
>       name: test-struct
>       type: struct
>       members:
>         -
>           name: reserved
>           type: pad
>           # len intentionally omitted
>
>   attribute-sets: []
>
>   operations:
>     list: []
>
> Signed-off-by: Taylor Bates <tmbates12@gmail.com>

Good catch. We have a lint check on the specs but not the schemas. Maybe
need to add that.

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

  parent reply	other threads:[~2026-09-17  8:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  1:53 Taylor Bates
2026-09-15  3:01 ` Hangbin Liu
2026-09-17  8:35 ` Donald Hunter [this message]
2026-09-17 22:05   ` tmbates12
2026-09-17 14:20 ` patchwork-bot+netdevbpf

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=m2ecesp96s.fsf@gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=tmbates12@gmail.com \
    /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

all inboxes | Powered by JetHome®