Skip to content

Commit

Permalink
[media] s5k5baf: Add missing error check for devm_kzalloc
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kiran Padwal authored and Mauro Carvalho Chehab committed Apr 8, 2015
1 parent 5ed1c32 commit 51b5b3d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/media/i2c/s5k5baf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 51b5b3d

Please sign in to comment.