Skip to content

Commit

Permalink
video: ARM CLCD: Add missing error check for devm_kzalloc
Browse files Browse the repository at this point in the history
This patch add a missing 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>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
  • Loading branch information
Kiran Padwal authored and Tomi Valkeinen committed Feb 26, 2015
1 parent c517d83 commit 11f09e5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/video/fbdev/amba-clcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,9 @@ static int clcdfb_of_get_mode(struct device *dev, struct device_node *endpoint,

len = clcdfb_snprintf_mode(NULL, 0, mode);
name = devm_kzalloc(dev, len + 1, GFP_KERNEL);
if (!name)
return -ENOMEM;

clcdfb_snprintf_mode(name, len + 1, mode);
mode->name = name;

Expand Down

0 comments on commit 11f09e5

Please sign in to comment.