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

Commit e3fa3aff authored by Lars Ellenberg's avatar Lars Ellenberg Committed by David S. Miller
Browse files

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: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f5a45325
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -148,7 +148,7 @@ nla_policy_len(const struct nla_policy *p, int n)
{
{
	int i, len = 0;
	int i, len = 0;


	for (i = 0; i < n; i++) {
	for (i = 0; i < n; i++, p++) {
		if (p->len)
		if (p->len)
			len += nla_total_size(p->len);
			len += nla_total_size(p->len);
		else if (nla_attr_minlen[p->type])
		else if (nla_attr_minlen[p->type])