Skip to content

Commit

Permalink
net: fix nla_policy_len to actually _iterate_ over the policy
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
lge authored and davem330 committed Feb 28, 2011
1 parent f5a4532 commit e3fa3af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/nlattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit e3fa3af

Please sign in to comment.