[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150225133532.GU19745@mwanda>
Date: Wed, 25 Feb 2015 16:35:32 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Jiri Pirko <jiri@...nulli.us>
Cc: Scott Feldman <sfeldma@...il.com>, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [patch 1/2] rocker: add a check for NULL in rocker_probe_ports()
Make sure kmalloc() succeeds.
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c
index 34389b6a..713a13c 100644
--- a/drivers/net/ethernet/rocker/rocker.c
+++ b/drivers/net/ethernet/rocker/rocker.c
@@ -4201,6 +4201,8 @@ static int rocker_probe_ports(struct rocker *rocker)
alloc_size = sizeof(struct rocker_port *) * rocker->port_count;
rocker->ports = kmalloc(alloc_size, GFP_KERNEL);
+ if (!rocker->ports)
+ return -ENOMEM;
for (i = 0; i < rocker->port_count; i++) {
err = rocker_probe_port(rocker, i);
if (err)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists