Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1587bac4 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller
Browse files

[NET_SCHED]: Use typeful attribute parsing helpers

parent 24beeab5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -690,7 +690,7 @@ tcf_action_get_1(struct nlattr *nla, struct nlmsghdr *n, u32 pid)
	if (tb[TCA_ACT_INDEX] == NULL ||
	    nla_len(tb[TCA_ACT_INDEX]) < sizeof(index))
		goto err_out;
	index = *(int *)nla_data(tb[TCA_ACT_INDEX]);
	index = nla_get_u32(tb[TCA_ACT_INDEX]);

	err = -ENOMEM;
	a = kzalloc(sizeof(struct tc_action), GFP_KERNEL);
+2 −2
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ static int tcf_ipt_init(struct nlattr *nla, struct nlattr *est,

	if (tb[TCA_IPT_INDEX] != NULL &&
	    nla_len(tb[TCA_IPT_INDEX]) >= sizeof(u32))
		index = *(u32 *)nla_data(tb[TCA_IPT_INDEX]);
		index = nla_get_u32(tb[TCA_IPT_INDEX]);

	pc = tcf_hash_check(index, a, bind, &ipt_hash_info);
	if (!pc) {
@@ -140,7 +140,7 @@ static int tcf_ipt_init(struct nlattr *nla, struct nlattr *est,
	}
	ipt = to_ipt(pc);

	hook = *(u32 *)nla_data(tb[TCA_IPT_HOOK]);
	hook = nla_get_u32(tb[TCA_IPT_HOOK]);

	err = -ENOMEM;
	tname = kmalloc(IFNAMSIZ, GFP_KERNEL);
+2 −3
Original line number Diff line number Diff line
@@ -203,7 +203,7 @@ static int tcf_act_police_locate(struct nlattr *nla, struct nlattr *est,
	}

	if (tb[TCA_POLICE_RESULT])
		police->tcfp_result = *(u32*)nla_data(tb[TCA_POLICE_RESULT]);
		police->tcfp_result = nla_get_u32(tb[TCA_POLICE_RESULT]);
	police->tcfp_toks = police->tcfp_burst = parm->burst;
	police->tcfp_mtu = parm->mtu;
	if (police->tcfp_mtu == 0) {
@@ -216,8 +216,7 @@ static int tcf_act_police_locate(struct nlattr *nla, struct nlattr *est,
	police->tcf_action = parm->action;

	if (tb[TCA_POLICE_AVRATE])
		police->tcfp_ewma_rate =
			*(u32*)nla_data(tb[TCA_POLICE_AVRATE]);
		police->tcfp_ewma_rate = nla_get_u32(tb[TCA_POLICE_AVRATE]);
	if (est)
		gen_replace_estimator(&police->tcf_bstats,
				      &police->tcf_rate_est,
+1 −1
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ static inline int basic_set_parms(struct tcf_proto *tp, struct basic_filter *f,
		goto errout;

	if (tb[TCA_BASIC_CLASSID]) {
		f->res.classid = *(u32*)nla_data(tb[TCA_BASIC_CLASSID]);
		f->res.classid = nla_get_u32(tb[TCA_BASIC_CLASSID]);
		tcf_bind_filter(tp, &f->res, base);
	}

+3 −3
Original line number Diff line number Diff line
@@ -203,7 +203,7 @@ fw_change_attrs(struct tcf_proto *tp, struct fw_filter *f,
	if (tb[TCA_FW_CLASSID]) {
		if (nla_len(tb[TCA_FW_CLASSID]) != sizeof(u32))
			goto errout;
		f->res.classid = *(u32*)nla_data(tb[TCA_FW_CLASSID]);
		f->res.classid = nla_get_u32(tb[TCA_FW_CLASSID]);
		tcf_bind_filter(tp, &f->res, base);
	}

@@ -218,7 +218,7 @@ fw_change_attrs(struct tcf_proto *tp, struct fw_filter *f,
	if (tb[TCA_FW_MASK]) {
		if (nla_len(tb[TCA_FW_MASK]) != sizeof(u32))
			goto errout;
		mask = *(u32*)nla_data(tb[TCA_FW_MASK]);
		mask = nla_get_u32(tb[TCA_FW_MASK]);
		if (mask != head->mask)
			goto errout;
	} else if (head->mask != 0xFFFFFFFF)
@@ -264,7 +264,7 @@ static int fw_change(struct tcf_proto *tp, unsigned long base,
		if (tb[TCA_FW_MASK]) {
			if (nla_len(tb[TCA_FW_MASK]) != sizeof(u32))
				return -EINVAL;
			mask = *(u32*)nla_data(tb[TCA_FW_MASK]);
			mask = nla_get_u32(tb[TCA_FW_MASK]);
		}

		head = kzalloc(sizeof(struct fw_head), GFP_KERNEL);
Loading