aboutsummaryrefslogtreecommitdiff
path: root/datapath/brcompat.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-01-19 16:16:08 -0800
committerBen Pfaff <blp@nicira.com>2011-01-27 21:08:37 -0800
commit7897d3fa21ec370997e4f108b01de2664bec0a67 (patch)
tree0ab11d70d60209b129220eaf65438119490932e7 /datapath/brcompat.c
parentc283069c71adc49c182a1ac569a05e2dca949eda (diff)
datapath: Make VERIFY_NUL_STRING verify the string length too.
It's better to use HAVE_NLA_NUL_STRING than a version check because the Xen 2.6.18 kernels backport NLA_NUL_STRING and the nla_policy changes. Just defining NLA_NUL_STRING to an innocuous value doesn't work, because Linux before 2.6.19 doesn't define a 'len' member in struct nla_policy at all (it was named 'minlen' and had different semantics), so attempting to initialize it caused compile errors. Grouping things this way also makes it clearer what needs to be deleted when upstreaming. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'datapath/brcompat.c')
-rw-r--r--datapath/brcompat.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/datapath/brcompat.c b/datapath/brcompat.c
index 15cec9c9..43cbfb0d 100644
--- a/datapath/brcompat.c
+++ b/datapath/brcompat.c
@@ -408,9 +408,13 @@ static struct genl_ops brc_genl_ops_query_dp = {
static struct nla_policy brc_genl_policy[BRC_GENL_A_MAX + 1] = {
[BRC_GENL_A_ERR_CODE] = { .type = NLA_U32 },
- [BRC_GENL_A_PROC_DIR] = { .type = NLA_NUL_STRING },
- [BRC_GENL_A_PROC_NAME] = { .type = NLA_NUL_STRING },
+#ifdef HAVE_NLA_NUL_STRING
+ [BRC_GENL_A_PROC_DIR] = { .type = NLA_NUL_STRING,
+ .len = BRC_NAME_LEN_MAX },
+ [BRC_GENL_A_PROC_NAME] = { .type = NLA_NUL_STRING,
+ .len = BRC_NAME_LEN_MAX },
[BRC_GENL_A_PROC_DATA] = { .type = NLA_NUL_STRING },
+#endif
[BRC_GENL_A_FDB_DATA] = { .type = NLA_UNSPEC },
};