Skip to content
Snippets Groups Projects
Commit 7682736c authored by eric.gao@rock-chips.com's avatar eric.gao@rock-chips.com Committed by Anatolij Gustschin
Browse files

video: Fix crash when scroll screen


After enabling log printing to lcd, when the screen starts
scrolling, system crashes. Log is shown as bellow:

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

Checking the source code, we found that the variable "pixels"
gets 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 bytes for a character. So the variable "pixels" is 4
times bigger than it's exact value, which will cause the memory
overflow when the cpu runs the following code:

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

Signed-off-by: default avatarEric Gao <eric.gao@rock-chips.com>
parent e6a419c5
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,7 @@ static int console_normal_set_row(struct udevice *dev, uint row, int clr) ...@@ -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); struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
void *line; void *line;
int pixels = VIDEO_FONT_HEIGHT * vid_priv->line_length; int pixels = VIDEO_FONT_HEIGHT * vid_priv->xsize;
int i; int i;
line = vid_priv->fb + row * VIDEO_FONT_HEIGHT * vid_priv->line_length; line = vid_priv->fb + row * VIDEO_FONT_HEIGHT * vid_priv->line_length;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment