Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1524612
| From | Johan Hovold <johan@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH net v2 6/7] net: ethernet: ti: cpsw: add missing sanity check |
| Date | 2016-11-17 18:50 +0100 |
| Message-ID | <sEyYW-3Mb-53@gated-at.bofh.it> (permalink) |
| References | <sEycx-3cA-27@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Make sure to check for allocation failures before dereferencing a
NULL-pointer during probe.
Fixes: 649a1688c960 ("net: ethernet: ti: cpsw: create common struct to
hold shared driver data")
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/net/ethernet/ti/cpsw.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 11b2daef3158..1387299030e4 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2588,6 +2588,9 @@ static int cpsw_probe(struct platform_device *pdev)
int irq;
cpsw = devm_kzalloc(&pdev->dev, sizeof(struct cpsw_common), GFP_KERNEL);
+ if (!cpsw)
+ return -ENOMEM;
+
cpsw->dev = &pdev->dev;
ndev = alloc_etherdev_mq(sizeof(struct cpsw_priv), CPSW_MAX_QUEUES);
--
2.7.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH net v2 0/7] net: cpsw: fix leaks and probe deferral Johan Hovold <johan@kernel.org> - 2016-11-17 18:40 +0100 [PATCH net v2 3/7] net: ethernet: ti: cpsw: fix deferred probe Johan Hovold <johan@kernel.org> - 2016-11-17 18:50 +0100 [PATCH net v2 5/7] net: ethernet: ti: cpsw: fix secondary-emac probe error path Johan Hovold <johan@kernel.org> - 2016-11-17 18:50 +0100 [PATCH net v2 1/7] net: ethernet: ti: cpsw: fix bad register access in probe error path Johan Hovold <johan@kernel.org> - 2016-11-17 18:50 +0100 [PATCH net v2 6/7] net: ethernet: ti: cpsw: add missing sanity check Johan Hovold <johan@kernel.org> - 2016-11-17 18:50 +0100 Re: [PATCH net v2 0/7] net: cpsw: fix leaks and probe deferral David Miller <davem@davemloft.net> - 2016-11-18 19:50 +0100
csiph-web