Commit e3fa3aff0cb198e7c53d894f52146121d9592872

Authored by Lars Ellenberg
Committed by David S. Miller
1 parent f5a4532528

net: fix nla_policy_len to actually _iterate_ over the policy

Currently nla_policy_len always returns n * NLA_HDRLEN:
It loops, but does not advance it's iterator.
NLA_UNSPEC == 0 does not contain a .len in any policy.

Trivially fixed by adding p++.

Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -148,7 +148,7 @@
148 148 {
149 149 int i, len = 0;
150 150  
151   - for (i = 0; i < n; i++) {
  151 + for (i = 0; i < n; i++, p++) {
152 152 if (p->len)
153 153 len += nla_total_size(p->len);
154 154 else if (nla_attr_minlen[p->type])