diff options
author | Maciej Purski <m.purski@samsung.com> | 2017-11-22 10:08:38 +0100 |
---|---|---|
committer | Andrzej Hajda <a.hajda@samsung.com> | 2018-06-13 16:26:57 +0200 |
commit | 9378cecb1ce5d618b8aff4d65113ddcf72fc1011 (patch) | |
tree | 7a9825db8a416f8995020054deb5e74d76e6fb97 /drivers | |
parent | drm/bridge/sii8620: fix display modes validation (diff) | |
download | linux-9378cecb1ce5d618b8aff4d65113ddcf72fc1011.tar.xz linux-9378cecb1ce5d618b8aff4d65113ddcf72fc1011.zip |
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: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: bf1722ca ("drm/bridge/sii8620: rewrite hdmi start sequence")
Signed-off-by: Maciej Purski <m.purski@samsung.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1511341718-6974-1-git-send-email-m.purski@samsung.com
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/bridge/sil-sii8620.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c index 5267dc6551af..61fd3e0a4ba6 100644 --- a/drivers/gpu/drm/bridge/sil-sii8620.c +++ b/drivers/gpu/drm/bridge/sil-sii8620.c @@ -1226,7 +1226,7 @@ static void sii8620_start_video(struct sii8620 *ctx) int clk = ctx->pixel_clock * (ctx->use_packed_pixel ? 2 : 3); 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) break; |