[media] s5k5baf: Add missing error check for devm_kzalloc
authorKiran Padwal <kiran.padwal@smartplayin.com>
Thu, 5 Feb 2015 10:09:10 +0000 (07:09 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 8 Apr 2015 10:59:23 +0000 (07:59 -0300)
This patch add a missing a check on the return value of devm_kzalloc,
which would cause a NULL pointer dereference in a OOM situation.

Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com>
Acked-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/i2c/s5k5baf.c

index 96e7a48..297ef04 100644 (file)
@@ -374,6 +374,8 @@ static int s5k5baf_fw_parse(struct device *dev, struct s5k5baf_fw **fw,
        count -= S5K5BAG_FW_TAG_LEN;
 
        d = devm_kzalloc(dev, count * sizeof(u16), GFP_KERNEL);
+       if (!d)
+               return -ENOMEM;
 
        for (i = 0; i < count; ++i)
                d[i] = le16_to_cpu(data[i]);