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  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]
Date:	Fri, 18 Jul 2014 11:01:06 +0200
From:	Tom Gundersen <teg@...m.no>
To:	Veaceslav Falico <vfalico@...il.com>
Cc:	netdev <netdev@...r.kernel.org>,
	"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH v3 net-next 1/2] net: use dev->name in netdev_pr* when
 it's available

On Thu, Jul 17, 2014 at 7:46 PM, Veaceslav Falico <vfalico@...il.com> wrote:
> netdev_name() returns dev->name only when the net_device is in
> NETREG_REGISTERED state.
>
> However, dev->name is always populated on creation, so we can easily use
> it.
>
> There are two cases when there's no real name - when it's an empty string
> or when the name is in form of "eth%d", then netdev_name() returns "unnamed
> net_device".
>
> CC: "David S. Miller" <davem@...emloft.net>
> CC: Tom Gundersen <teg@...m.no>

Acked-by: Tom Gundersen <teg@...m.no>

> Signed-off-by: Veaceslav Falico <vfalico@...il.com>
> ---
>
> Notes:
>     v1->v2:
>     Also account for an empty string, as Tom Gundersen suggested.
>
>  include/linux/netdevice.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 15ed750..70256aa 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -3383,8 +3383,8 @@ extern struct pernet_operations __net_initdata loopback_net_ops;
>
>  static inline const char *netdev_name(const struct net_device *dev)
>  {
> -       if (dev->reg_state != NETREG_REGISTERED)
> -               return "(unregistered net_device)";
> +       if (!dev->name[0] || strchr(dev->name, '%'))
> +               return "(unnamed net_device)";
>         return dev->name;
>  }
>
> --
> 1.8.4
>
--
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