Skip to content

Commit

Permalink
drm/omap: fix NULL deref crash with SDI displays
Browse files Browse the repository at this point in the history
Fix a NULL deref bug introduced in commit 24aac60 ("drm: omapdrm:
sdi: Allocate the sdi private data structure dynamically").

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/2f803bfc-3ffe-332a-7b9a-d59a39db4630@ti.com
Fixes: 24aac60 ("drm: omapdrm: sdi: Allocate the sdi private data structure dynamically")
Reported-by: Tony Lindgren <tony@atomide.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Benoit Parrot <bparrot@ti.com>
  • Loading branch information
tomba committed May 24, 2018
1 parent bdcc02c commit 2bc5ff0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/gpu/drm/omapdrm/dss/sdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static int sdi_calc_clock_div(struct sdi_device *sdi, unsigned long pclk,
struct dispc_clock_info *dispc_cinfo)
{
int i;
struct sdi_clk_calc_ctx ctx = { .sdi = sdi };
struct sdi_clk_calc_ctx ctx;

/*
* DSS fclk gives us very few possibilities, so finding a good pixel
Expand All @@ -95,6 +95,9 @@ static int sdi_calc_clock_div(struct sdi_device *sdi, unsigned long pclk,
bool ok;

memset(&ctx, 0, sizeof(ctx));

ctx.sdi = sdi;

if (pclk > 1000 * i * i * i)
ctx.pck_min = max(pclk - 1000 * i * i * i, 0lu);
else
Expand Down

0 comments on commit 2bc5ff0

Please sign in to comment.