Commit 2bc5ff0b authored by Tomi Valkeinen's avatar Tomi Valkeinen

drm/omap: fix NULL deref crash with SDI displays

Fix a NULL deref bug introduced in commit 24aac601 ("drm: omapdrm:
sdi: Allocate the sdi private data structure dynamically").
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/2f803bfc-3ffe-332a-7b9a-d59a39db4630@ti.com
Fixes: 24aac601 ("drm: omapdrm: sdi: Allocate the sdi private data structure dynamically")
Reported-by: default avatarTony Lindgren <tony@atomide.com>
Tested-by: default avatarTony Lindgren <tony@atomide.com>
Reviewed-by: default avatarBenoit Parrot <bparrot@ti.com>
parent bdcc02cf
...@@ -82,7 +82,7 @@ static int sdi_calc_clock_div(struct sdi_device *sdi, unsigned long pclk, ...@@ -82,7 +82,7 @@ static int sdi_calc_clock_div(struct sdi_device *sdi, unsigned long pclk,
struct dispc_clock_info *dispc_cinfo) struct dispc_clock_info *dispc_cinfo)
{ {
int i; 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 * DSS fclk gives us very few possibilities, so finding a good pixel
...@@ -95,6 +95,9 @@ static int sdi_calc_clock_div(struct sdi_device *sdi, unsigned long pclk, ...@@ -95,6 +95,9 @@ static int sdi_calc_clock_div(struct sdi_device *sdi, unsigned long pclk,
bool ok; bool ok;
memset(&ctx, 0, sizeof(ctx)); memset(&ctx, 0, sizeof(ctx));
ctx.sdi = sdi;
if (pclk > 1000 * i * i * i) if (pclk > 1000 * i * i * i)
ctx.pck_min = max(pclk - 1000 * i * i * i, 0lu); ctx.pck_min = max(pclk - 1000 * i * i * i, 0lu);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment