On Fri, 19 Jul 2019 13:00:26 +0200, Jiri Pirko wrote:
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 7a2010b16e10..f11a2367037d 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -980,6 +980,18 @@ static size_t rtnl_xdp_size(void)
>       return xdp_size;
>  }
>  
> +static size_t rtnl_alt_ifname_list_size(const struct net_device *dev)
> +{
> +     struct netdev_name_node *name_node;
> +     size_t size = nla_total_size(0);
> +
> +     if (list_empty(&dev->name_node->list))
> +             return 0;

Nit: it would make the intent a tiny bit clearer if 

        size = nla_total_size(0);

was after this early return.

> +     list_for_each_entry(name_node, &dev->name_node->list, list)
> +             size += nla_total_size(ALTIFNAMSIZ);

Since we have the structure I wonder if it would be worthwhile to store
the exact size in it?

> +     return size;
> +}
> +

Reply via email to