summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2018-03-07 03:39:04 +0100
committerJoe Hershberger <joe.hershberger@ni.com>2018-03-22 15:05:28 -0500
commitb24b1e4b1d6776ca12a57eff77956bce77b2e56f (patch)
tree7d84064fa5455987960adc5ce9714f84d519fd8d /drivers/net
parentdfa1a74045c930ec3935f748b0969f9d76352e13 (diff)
net: mvpp2x: add check after calloc
After allocating plat the pointer is checked. Afterwards name is allocated and not checked. Add the missing check to avoid a possible NULL dereference. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/mvpp2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index e3d31a560d..62c0c2be06 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -5598,6 +5598,10 @@ static int mvpp2_base_bind(struct udevice *parent)
id += base_id_add;
name = calloc(1, 16);
+ if (!name) {
+ free(plat);
+ return -ENOMEM;
+ }
sprintf(name, "mvpp2-%d", id);
/* Create child device UCLASS_ETH and bind it */