1
0
mirror of https://github.com/torvalds/linux.git synced 2024-12-15 15:41:58 +00:00

[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>
This commit is contained in:
Kiran Padwal 2015-02-05 07:09:10 -03:00 committed by Mauro Carvalho Chehab
parent 5ed1c328ea
commit 51b5b3d6c9

View File

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