From: Heinrich Schuchardt Date: Wed, 7 Mar 2018 02:39:04 +0000 (+0100) Subject: net: mvpp2x: add check after calloc X-Git-Tag: v2018.05-rc1~11^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b24b1e4b1d6776ca12a57eff77956bce77b2e56f;p=platform%2Fkernel%2Fu-boot.git 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 Acked-by: Joe Hershberger --- diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c index e3d31a5..62c0c2b 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 */