Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1265839

Re: [PATCH] net: caif: check return value of alloc_netdev

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH] net: caif: check return value of alloc_netdev
Date 2015-11-09 17:40 +0100
Message-ID <qsXE6-pE-19@gated-at.bofh.it> (permalink)
References <qsTAu-6h4-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Rasmus Villemoes <linux@rasmusvillemoes.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@rasmusvillemoes.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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] net: caif: check return value of alloc_netdev Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-11-09 13:20 +0100
  Re: [PATCH] net: caif: check return value of alloc_netdev David Miller <davem@davemloft.net> - 2015-11-09 17:40 +0100

csiph-web