]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: loop: Check for memory allocation failure
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Sat, 6 May 2017 05:29:45 +0000 (07:29 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 May 2017 18:58:36 +0000 (14:58 -0400)
commit65a323b919c970871f15ed63c755e98c708b9002
treeae6574bb9c4715131a3d0729c29c3be1e5c32fc6
parentfe0b15f63e4aa78a5444936752926e61b7dde345
net: dsa: loop: Check for memory allocation failure

If 'devm_kzalloc' fails, a NULL pointer will be dereferenced.
Return -ENOMEM instead, as done for some other memory allocation just a
few lines above.

Fixes: 54824ee51f3e ("net: dsa: Mock-up driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/dsa_loop.c