]> err.no Git - linux-2.6/blobdiff - net/sched/sch_atm.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6] / net / sched / sch_atm.c
index 4d876598d7dfeb2ec3ea06d06793dd0305c69aa0..33527341638427c3bf9e97385a7f7d5ba37f07d8 100644 (file)
@@ -195,6 +195,11 @@ static const u8 llc_oui_ip[] = {
        0x08, 0x00
 };                             /* Ethertype IP (0800) */
 
+static const struct nla_policy atm_policy[TCA_ATM_MAX + 1] = {
+       [TCA_ATM_FD]            = { .type = NLA_U32 },
+       [TCA_ATM_EXCESS]        = { .type = NLA_U32 },
+};
+
 static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
                         struct nlattr **tca, unsigned long *arg)
 {
@@ -225,13 +230,14 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
                return -EBUSY;
        if (opt == NULL)
                return -EINVAL;
-       error = nla_parse_nested(tb, TCA_ATM_MAX, opt, NULL);
+
+       error = nla_parse_nested(tb, TCA_ATM_MAX, opt, atm_policy);
        if (error < 0)
                return error;
 
-       if (!tb[TCA_ATM_FD] || nla_len(tb[TCA_ATM_FD]) < sizeof(fd))
+       if (!tb[TCA_ATM_FD])
                return -EINVAL;
-       fd = *(int *)nla_data(tb[TCA_ATM_FD]);
+       fd = nla_get_u32(tb[TCA_ATM_FD]);
        pr_debug("atm_tc_change: fd %d\n", fd);
        if (tb[TCA_ATM_HDR]) {
                hdr_len = nla_len(tb[TCA_ATM_HDR]);
@@ -243,10 +249,8 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
        if (!tb[TCA_ATM_EXCESS])
                excess = NULL;
        else {
-               if (nla_len(tb[TCA_ATM_EXCESS]) != sizeof(u32))
-                       return -EINVAL;
                excess = (struct atm_flow_data *)
-                       atm_tc_get(sch, *(u32 *)nla_data(tb[TCA_ATM_EXCESS]));
+                       atm_tc_get(sch, nla_get_u32(tb[TCA_ATM_EXCESS]));
                if (!excess)
                        return -ENOENT;
        }