[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20151109.113141.2248149943645747388.davem@davemloft.net>
Date: Mon, 09 Nov 2015 11:31:41 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: linux@...musvillemoes.dk
Cc: dmitry.tarnyagin@...kless.no, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: caif: check return value of alloc_netdev
From: Rasmus Villemoes <linux@...musvillemoes.dk>
Date: Mon, 9 Nov 2015 13:19:10 +0100
> I don't know if dev can actually be NULL here, but the test should be
> above alloc_netdev(), to avoid leaking the struct net_device in case
> dev is actually NULL. And of course the return value from alloc_netdev
> should be tested.
>
> Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
> ---
> Maybe the existing code was supposed to be "if (!ndev)", and dev
> cannot be NULL, but then -ENODEV is a slightly odd return
> value. Doing both tests seems to be the safe choice.
This is made painfully impossible to figure out because there seems
to be no in-tree code instantiating platform_device objects for
this caif_spi framework, nor are there even in-tree implementations
of the init_xfer et al. required methods.
So your fix is as good as any, applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists