/* Returns 0 on success or a negative error code.  */
int nla_policy_len(const struct nla_policy *p, int n)
/* Returns 0 on success or a negative error code.  */
int nla_policy_len(const struct nla_policy *p, int n)
{
	int i, len = 0;
	for (i = 0; i < n; i++) {
		if (p->len)
			len += nla_total_size(p->len);
		else if (nla_attr_minlen[p->type])
			len += nla_total_size(nla_attr_minlen[p->type]);
	}
	return len;
}