summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorKiran Padwal <kiran.padwal@smartplayin.com>2015-02-05 07:09:10 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-08 07:59:23 -0300
commit51b5b3d6c96ee244c51ec57265fc3c5ae5897610 (patch)
tree1fc2f612549e515aad131a28b4064ae8f43c2b91 /drivers
parent5ed1c328ea077d70e1ebcd5188dc77cdc754df3a (diff)
[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 <kiran.padwal@smartplayin.com> Acked-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/i2c/s5k5baf.c2
1 files changed, 2 insertions, 0 deletions
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]);