diff options
author | Johannes Berg <johannes.berg@intel.com> | 2020-08-18 10:17:33 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-08-18 12:28:45 -0700 |
commit | 8aa26c575fb343ebde810b30dad0cba7d8121efb (patch) | |
tree | d82231bd12bd50475c0eada026b3220f445292ec /drivers/fpga/dfl-pci.c | |
parent | bc0435855041d7fff0b83dd992fc4be34aa11afb (diff) | |
download | linux-8aa26c575fb343ebde810b30dad0cba7d8121efb.tar.bz2 |
netlink: make NLA_BINARY validation more flexible
Add range validation for NLA_BINARY, allowing validation of any
combination of combination minimum or maximum lengths, using the
existing NLA_POLICY_RANGE()/NLA_POLICY_FULL_RANGE() macros, just
like for integers where the value is checked.
Also make NLA_POLICY_EXACT_LEN(), NLA_POLICY_EXACT_LEN_WARN()
and NLA_POLICY_MIN_LEN() special cases of this, removing the old
types NLA_EXACT_LEN and NLA_MIN_LEN.
This allows us to save some code where both minimum and maximum
lengths are requires, currently the policy only allows maximum
(NLA_BINARY), minimum (NLA_MIN_LEN) or exact (NLA_EXACT_LEN), so
a range of lengths cannot be accepted and must be checked by the
code that consumes the attributes later.
Also, this allows advertising the correct ranges in the policy
export to userspace. Here, NLA_MIN_LEN and NLA_EXACT_LEN already
were special cases of NLA_BINARY with min and min/max length
respectively.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/fpga/dfl-pci.c')
0 files changed, 0 insertions, 0 deletions