Skip to content

Commit

Permalink
video: fbdev: pxafb: clear allocated memory for video modes
Browse files Browse the repository at this point in the history
When parsing the video modes from DT properties, make sure to zero out
memory before using it. This is important because not all fields in the mode
struct are explicitly initialized, even though they are used later on.

Fixes: 420a488 ("video: fbdev: pxafb: initial devicetree conversion")
Reviewed-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
  • Loading branch information
Daniel Mack authored and Bartlomiej Zolnierkiewicz committed Jul 24, 2018
1 parent aa45ee8 commit b951d80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/video/fbdev/pxafb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2128,8 +2128,8 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp,
return -EINVAL;

ret = -ENOMEM;
info->modes = kmalloc_array(timings->num_timings,
sizeof(info->modes[0]), GFP_KERNEL);
info->modes = kcalloc(timings->num_timings, sizeof(info->modes[0]),
GFP_KERNEL);
if (!info->modes)
goto out;
info->num_modes = timings->num_timings;
Expand Down

0 comments on commit b951d80

Please sign in to comment.