From: David Miller <davem@davemloft.net>
To: johannes@sipsolutions.net
Cc: netdev@vger.kernel.org, dsa@cumulusnetworks.com,
pablo@netfilter.org, johannes.berg@intel.com
Subject: Re: [PATCH 2/6] netlink: extend policy range validation
Date: Mon, 29 Apr 2019 22:49:51 -0400 (EDT) [thread overview]
Message-ID: <20190429.224951.1389806535373048089.davem@davemloft.net> (raw)
In-Reply-To: <20190426121306.10871-3-johannes@sipsolutions.net>
From: Johannes Berg <johannes@sipsolutions.net>
Date: Fri, 26 Apr 2019 14:13:02 +0200
> * NLA_POLICY_RANGE() macros.
> + * NLA_U8,
> + * NLA_U16,
> + * NLA_U32,
> + * NLA_U64 If the validation_type field instead is set to
> + * NLA_VALIDATE_RANGE_PTR, `range' must be a pointer
> + * to a struct netlink_range_validation that indicates
> + * the min/max values.
> + * Use NLA_POLICY_FULL_RANGE().
> + * NLA_S8,
> + * NLA_S16,
> + * NLA_S32,
> + * NLA_S64 If the validation_type field instead is set to
> + * NLA_VALIDATE_RANGE_PTR, `range_signed' must be a
> + * pointer to a struct netlink_range_validation_signed
> + * that indicates the min/max values.
> + * Use NLA_POLICY_FULL_RANGE_SIGNED().
Documentation and datastructure says that "range_signed" member should be set
for signed ranges, however:
> +#define NLA_POLICY_FULL_RANGE(tp, _range) { \
> + .type = NLA_ENSURE_UINT_TYPE(tp), \
> + .validation_type = NLA_VALIDATE_RANGE_PTR, \
> + .range = _range, \
> +}
> +
> +#define NLA_POLICY_FULL_RANGE_SIGNED(tp, _range) { \
> + .type = NLA_ENSURE_SINT_TYPE(tp), \
> + .validation_type = NLA_VALIDATE_RANGE_PTR, \
> + .range = _range, \
> +}
The NLA_POLICY_FULL_RANGE_SIGNED macros sets 'range' not 'range_signed'.
Also, since range and range_signed are in a union however there is only one
NLA_VALIDATE_RANGE_PTR type, how does one differentiate between signed and
unsigned ranges exactly?
Thanks.
next prev parent reply other threads:[~2019-04-30 2:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-26 12:13 [PATCH 0/6] netlink: expose policies to userspace Johannes Berg
2019-04-26 12:13 ` [PATCH 1/6] netlink: remove type-unsafe validation_data pointer Johannes Berg
2019-04-26 12:13 ` [PATCH 2/6] netlink: extend policy range validation Johannes Berg
2019-04-30 2:49 ` David Miller [this message]
2019-04-30 6:51 ` Johannes Berg
2019-04-26 12:13 ` [PATCH 3/6] netlink: allow NLA_MSECS to have " Johannes Berg
2019-04-26 12:13 ` [PATCH 4/6] netlink: remove NLA_EXACT_LEN_WARN Johannes Berg
2019-04-26 12:13 ` [PATCH 5/6] netlink: factor out policy range helpers Johannes Berg
2019-04-26 12:13 ` [PATCH 6/6] netlink: add infrastructure to expose policies to userspace Johannes Berg
2019-04-26 18:21 ` Pablo Neira Ayuso
2019-04-26 19:22 ` Johannes Berg
2019-04-27 11:25 ` Pablo Neira Ayuso
2019-04-28 20:03 ` Johannes Berg
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=20190429.224951.1389806535373048089.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=johannes.berg@intel.com \
--cc=johannes@sipsolutions.net \
--cc=netdev@vger.kernel.org \
--cc=pablo@netfilter.org \
/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.