public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] video: Fix crash when scroll screen
@ 2017-04-10  2:02 Eric Gao
  2017-04-14 14:04 ` Anatolij Gustschin
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Gao @ 2017-04-10  2:02 UTC (permalink / raw)
  To: u-boot

After enable log printing to lcd,when
the screen start scroll,system crash,
log is shown as bellow.

"Synchronous Abort" handler, esr 0x96000045
"Synchronous Abort" handler, esr 0x96000045

Checking the source code, we found that the
variate "pixels" get a wrong value.

int pixels = VIDEO_FONT_HEIGHT * vid_priv->line_length;

"pixels" here means the value of pixels for
a character,rather than the byte for a
character. so the variate "pixels" is 4 times
bigger than it's exact value. which will cause
the memory overflow when the cpu run the
following code.

for (i = 0; i < pixels; i++)
    *dst++ = clr; <<----

Signed-off-by: Eric Gao <eric.gao@rock-chips.com>

---

 drivers/video/console_normal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c
index 89a55dd..b627d48 100644
--- a/drivers/video/console_normal.c
+++ b/drivers/video/console_normal.c
@@ -18,7 +18,7 @@ static int console_normal_set_row(struct udevice *dev, uint row, int clr)
 {
 	struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
 	void *line;
-	int pixels = VIDEO_FONT_HEIGHT * vid_priv->line_length;
+	int pixels = VIDEO_FONT_HEIGHT * vid_priv->xsize;
 	int i;
 
 	line = vid_priv->fb + row * VIDEO_FONT_HEIGHT * vid_priv->line_length;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-14 14:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-10  2:02 [U-Boot] [PATCH] video: Fix crash when scroll screen Eric Gao
2017-04-14 14:04 ` Anatolij Gustschin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox