Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1637414
| From | David Laight <David.Laight@ACULAB.COM> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | RE: [PATCH] net: dsa: loop: Check for memory allocation failure |
| Date | 2017-05-08 14:10 +0200 |
| Message-ID | <tEPEe-3LB-9@gated-at.bofh.it> (permalink) |
| References | <tE0BH-3Xk-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Christophe JAILLET > Sent: 06 May 2017 06:30 > 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. ... > --- a/drivers/net/dsa/dsa_loop.c > +++ b/drivers/net/dsa/dsa_loop.c > @@ -256,6 +256,9 @@ static int dsa_loop_drv_probe(struct mdio_device *mdiodev) > return -ENOMEM; > > ps = devm_kzalloc(&mdiodev->dev, sizeof(*ps), GFP_KERNEL); > + if (!ps) > + return -ENOMEM; > + > ps->netdev = dev_get_by_name(&init_net, pdata->netdev); > if (!ps->netdev) > return -EPROBE_DEFER; On the face if it this code leaks like a sieve. David
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] net: dsa: loop: Check for memory allocation failure Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-05-06 07:40 +0200
Re: [PATCH] net: dsa: loop: Check for memory allocation failure Andrew Lunn <andrew@lunn.ch> - 2017-05-06 16:50 +0200
Re: [PATCH] net: dsa: loop: Check for memory allocation failure Florian Fainelli <f.fainelli@gmail.com> - 2017-05-08 01:30 +0200
RE: [PATCH] net: dsa: loop: Check for memory allocation failure David Laight <David.Laight@ACULAB.COM> - 2017-05-08 14:10 +0200
RE: [PATCH] net: dsa: loop: Check for memory allocation failure Julia Lawall <julia.lawall@lip6.fr> - 2017-05-08 14:40 +0200
Re: [PATCH] net: dsa: loop: Check for memory allocation failure Joe Perches <joe@perches.com> - 2017-05-08 21:50 +0200
Re: [PATCH] net: dsa: loop: Check for memory allocation failure Julia Lawall <julia.lawall@lip6.fr> - 2017-05-09 01:50 +0200
Re: [PATCH] net: dsa: loop: Check for memory allocation failure Florian Fainelli <f.fainelli@gmail.com> - 2017-05-09 02:40 +0200
Re: [PATCH] net: dsa: loop: Check for memory allocation failure Julia Lawall <julia.lawall@lip6.fr> - 2017-05-09 02:50 +0200
Re: [PATCH] net: dsa: loop: Check for memory allocation failure Joe Perches <joe@perches.com> - 2017-05-09 17:20 +0200
Re: [PATCH] net: dsa: loop: Check for memory allocation failure Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-05-10 06:40 +0200
Re: [PATCH] net: dsa: loop: Check for memory allocation failure Julia Lawall <julia.lawall@lip6.fr> - 2017-05-10 06:50 +0200
Re: [PATCH] net: dsa: loop: Check for memory allocation failure Marion & Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-05-10 07:00 +0200
Re: [PATCH] net: dsa: loop: Check for memory allocation failure David Miller <davem@davemloft.net> - 2017-05-08 21:10 +0200
csiph-web