[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9845d969b0af4f7ca534144bc5d4872e@AcuMS.aculab.com>
Date: Mon, 20 Nov 2017 14:26:27 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Rasmus Villemoes' <linux@...musvillemoes.dk>,
"David S. Miller" <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 3/7] net: core: eliminate dev_alloc_name{,_ns} code
duplication
From: Rasmus Villemoes
> Sent: 12 November 2017 23:15
> dev_alloc_name contained a BUG_ON(), which I moved to dev_alloc_name_ns;
> the only other caller of that already has the same BUG_ON.
>
> Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
> ---
> net/core/dev.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 240ae6bc1097..1077bfe97bde 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1112,6 +1112,7 @@ static int dev_alloc_name_ns(struct net *net,
> char buf[IFNAMSIZ];
> int ret;
>
> + BUG_ON(!net);
> ret = __dev_alloc_name(net, name, buf);
Just delete it.
The NULL pointer dereference is as easy to debug as the BUG().
David
Powered by blists - more mailing lists