From 51b5b3d6c96ee244c51ec57265fc3c5ae5897610 Mon Sep 17 00:00:00 2001 From: Kiran Padwal Date: Thu, 5 Feb 2015 07:09:10 -0300 Subject: [media] s5k5baf: Add missing error check for devm_kzalloc 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 Acked-by: Andrzej Hajda Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/s5k5baf.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/media/i2c') diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c index 96e7a4834130..297ef04e146a 100644 --- a/drivers/media/i2c/s5k5baf.c +++ b/drivers/media/i2c/s5k5baf.c @@ -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]); -- cgit v1.2.3