All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Nikolay Aleksandrov <razor@blackwall.org>
Cc: bpf@vger.kernel.org, jiri@resnulli.us, netdev@vger.kernel.org,
	martin.lau@linux.dev, ast@kernel.org, andrii@kernel.org,
	john.fastabend@gmail.com, andrew@lunn.ch, toke@kernel.org,
	toke@redhat.com, sdf@google.com, daniel@iogearbox.net,
	idosch@idosch.org
Subject: Re: [PATCH bpf-next v2] netkit: use netlink policy for mode and policy attributes validation
Date: Thu, 26 Oct 2023 08:43:51 -0700	[thread overview]
Message-ID: <20231026084351.6bb4ba8a@kernel.org> (raw)
In-Reply-To: <20231026151659.1676037-1-razor@blackwall.org>

On Thu, 26 Oct 2023 18:16:59 +0300 Nikolay Aleksandrov wrote:
>  static const struct nla_policy netkit_policy[IFLA_NETKIT_MAX + 1] = {
>  	[IFLA_NETKIT_PEER_INFO]		= { .len = sizeof(struct ifinfomsg) },
> -	[IFLA_NETKIT_POLICY]		= { .type = NLA_U32 },
> -	[IFLA_NETKIT_MODE]		= { .type = NLA_U32 },
> -	[IFLA_NETKIT_PEER_POLICY]	= { .type = NLA_U32 },
> +	[IFLA_NETKIT_POLICY]		= NLA_POLICY_VALIDATE_FN(NLA_BINARY,
> +								 netkit_check_policy,
> +								 sizeof(u32)),
> +	[IFLA_NETKIT_MODE]		= NLA_POLICY_VALIDATE_FN(NLA_BINARY,
> +								 netkit_check_mode,
> +								 sizeof(u32)),
> +	[IFLA_NETKIT_PEER_POLICY]	= NLA_POLICY_VALIDATE_FN(NLA_BINARY,
> +								 netkit_check_policy,
> +								 sizeof(u32)),

I vote to leave this code be. It's not perfect. But typing it as binary
is not getting us closer to perfection.

  reply	other threads:[~2023-10-26 15:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26 15:16 [PATCH bpf-next v2] netkit: use netlink policy for mode and policy attributes validation Nikolay Aleksandrov
2023-10-26 15:43 ` Jakub Kicinski [this message]
2023-10-26 16:02   ` Nikolay Aleksandrov
2023-10-26 16:21   ` Jiri Pirko

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=20231026084351.6bb4ba8a@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=idosch@idosch.org \
    --cc=jiri@resnulli.us \
    --cc=john.fastabend@gmail.com \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=razor@blackwall.org \
    --cc=sdf@google.com \
    --cc=toke@kernel.org \
    --cc=toke@redhat.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 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.