]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
net: fix nla_policy_len to actually _iterate_ over the policy
authorLars Ellenberg <lars.ellenberg@linbit.com>
Mon, 28 Feb 2011 20:38:25 +0000 (12:38 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Feb 2011 20:38:25 +0000 (12:38 -0800)
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>
lib/nlattr.c

index 5021cbc344115c5281cc5427a0847f43fb7d9f39..ac09f2226dc748132cd869bdf0933a5daf7509c4 100644 (file)
@@ -148,7 +148,7 @@ nla_policy_len(const struct nla_policy *p, int n)
 {
        int i, len = 0;
 
-       for (i = 0; i < n; i++) {
+       for (i = 0; i < n; i++, p++) {
                if (p->len)
                        len += nla_total_size(p->len);
                else if (nla_attr_minlen[p->type])