On Thu, 18 Mar 2021 04:42:53 +0100
Jiri Bohac <jbo...@suse.cz> wrote:

>               for_each_netdev(net, d) {
> +                     struct netdev_name_node *name_node;
> +                     list_for_each_entry(name_node, &d->name_node->list, 
> list) {
> +                             if (!sscanf(name_node->name, name, &i))
> +                                     continue;
> +                             if (i < 0 || i >= max_netdevices)
> +                                     continue;
> +
> +                             /*  avoid cases where sscanf is not exact 
> inverse of printf */
> +                             snprintf(buf, IFNAMSIZ, name, i);
> +                             if (!strncmp(buf, name_node->name, IFNAMSIZ))
> +                                     set_bit(i, inuse);
> +                     }

Rather than copy/paste same code two places, why not make a helper function?

Reply via email to