[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140312.165443.1358759725438654072.davem@davemloft.net>
Date: Wed, 12 Mar 2014 16:54:43 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: mkubecek@...e.cz
Cc: hannes@...essinduktion.org, netdev@...r.kernel.org,
kuznet@....inr.ac.ru, jmorris@...ei.org, yoshfuji@...ux-ipv6.org,
kaber@...sh.net
Subject: Re: [PATCH net] ipv6: do not overwrite inetpeer metrics prematurely
From: Michal Kubecek <mkubecek@...e.cz>
Date: Tue, 11 Mar 2014 16:08:14 +0100
> + nla_for_each_attr(nla, mx, mx_len, remaining) {
> + int type = nla_type(nla);
> +
> + if (type) {
> + if (type > RTAX_MAX)
> + return -EINVAL;
> +
> + mp[type - 1] = nla_get_u32(nla);
> + }
> + }
It was surprising to me that nla_for_each_attr() works with a second
argument of NULL.
It only does so when the length is zero, due to how the test in nla_ok()
is codified.
I know it's a minor nit, but can you only execute this loop if mx is
non-NULL?
Perhaps you can put this into (yet another) helper function:
int __fib6_commit_metrics(u32 *mp, struct nlattr *mx, int mx_len)
Otherwise looks good to me.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists