Commit 9378cecb authored by Maciej Purski's avatar Maciej Purski Committed by Andrzej Hajda

drm/bridge/sii8620: fix potential buffer overflow

Buffer overflow error should not occur, as mode_fixup() callback
filters pixel clock value and it should never exceed 600000. However,
current implementation is not obviously safe and relies on
implementation of mode_fixup().

Make 'i' variable never reach unsafe value in order to avoid buffer
overflow error.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Fixes: bf1722ca ("drm/bridge/sii8620: rewrite hdmi start sequence")
Signed-off-by: default avatarMaciej Purski <m.purski@samsung.com>
Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1511341718-6974-1-git-send-email-m.purski@samsung.com
parent ecba7cfa
...@@ -1226,7 +1226,7 @@ static void sii8620_start_video(struct sii8620 *ctx) ...@@ -1226,7 +1226,7 @@ static void sii8620_start_video(struct sii8620 *ctx)
int clk = ctx->pixel_clock * (ctx->use_packed_pixel ? 2 : 3); int clk = ctx->pixel_clock * (ctx->use_packed_pixel ? 2 : 3);
int i; int i;
for (i = 0; i < ARRAY_SIZE(clk_spec); ++i) for (i = 0; i < ARRAY_SIZE(clk_spec) - 1; ++i)
if (clk < clk_spec[i].max_clk) if (clk < clk_spec[i].max_clk)
break; break;
......
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