lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210317211108.5b2cdc77@hermes.local>
Date:   Wed, 17 Mar 2021 21:11:08 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Jiri Bohac <jbohac@...e.cz>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        Jiri Pirko <jiri@...dia.com>
Subject: Re: [PATCH] net: check all name nodes in  __dev_alloc_name

On Thu, 18 Mar 2021 04:42:53 +0100
Jiri Bohac <jbohac@...e.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?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ