mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
pkt_sched: Stop using NLA_PUT*().
These macros contain a hidden goto, and are thus extremely error prone and make code hard to audit. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9360ffd185
commit
1b34ec43c9
40 changed files with 263 additions and 157 deletions
|
@ -585,8 +585,9 @@ static void meta_var_apply_extras(struct meta_value *v,
|
|||
|
||||
static int meta_var_dump(struct sk_buff *skb, struct meta_value *v, int tlv)
|
||||
{
|
||||
if (v->val && v->len)
|
||||
NLA_PUT(skb, tlv, v->len, (void *) v->val);
|
||||
if (v->val && v->len &&
|
||||
nla_put(skb, tlv, v->len, (void *) v->val))
|
||||
goto nla_put_failure;
|
||||
return 0;
|
||||
|
||||
nla_put_failure:
|
||||
|
@ -636,10 +637,13 @@ static void meta_int_apply_extras(struct meta_value *v,
|
|||
|
||||
static int meta_int_dump(struct sk_buff *skb, struct meta_value *v, int tlv)
|
||||
{
|
||||
if (v->len == sizeof(unsigned long))
|
||||
NLA_PUT(skb, tlv, sizeof(unsigned long), &v->val);
|
||||
else if (v->len == sizeof(u32))
|
||||
NLA_PUT_U32(skb, tlv, v->val);
|
||||
if (v->len == sizeof(unsigned long)) {
|
||||
if (nla_put(skb, tlv, sizeof(unsigned long), &v->val))
|
||||
goto nla_put_failure;
|
||||
} else if (v->len == sizeof(u32)) {
|
||||
if (nla_put_u32(skb, tlv, v->val))
|
||||
goto nla_put_failure;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -831,7 +835,8 @@ static int em_meta_dump(struct sk_buff *skb, struct tcf_ematch *em)
|
|||
memcpy(&hdr.left, &meta->lvalue.hdr, sizeof(hdr.left));
|
||||
memcpy(&hdr.right, &meta->rvalue.hdr, sizeof(hdr.right));
|
||||
|
||||
NLA_PUT(skb, TCA_EM_META_HDR, sizeof(hdr), &hdr);
|
||||
if (nla_put(skb, TCA_EM_META_HDR, sizeof(hdr), &hdr))
|
||||
goto nla_put_failure;
|
||||
|
||||
ops = meta_type_ops(&meta->lvalue);
|
||||
if (ops->dump(skb, &meta->lvalue, TCA_EM_META_LVALUE) < 0 ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue