framebuffer: fix screen corruption when copying
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 16 Sep 2014 16:38:53 +0000 (12:38 -0400)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 30 Sep 2014 10:39:50 +0000 (13:39 +0300)
commit5b789da8a7fc357661fc61faaf853e9161cc9700
treedc19aed490c185c36a7a381d56ccd2badd76e65a
parentf74a289b9480648a654e5afd8458c2263c03a1e1
framebuffer: fix screen corruption when copying

The function bitcpy_rev has a bug that may result in screen corruption.
The bug happens under these conditions:
* the end of the destination area of a copy operation is aligned on a long
  word boundary
* the end of the source area is not aligned on a long word boundary
* we are copying more than one long word

In this case, the variable shift is non-zero and the variable first is
zero. The statements FB_WRITEL(comp(d0, FB_READL(dst), first), dst) reads
the last long word of the destination and writes it back unchanged
(because first is zero). Correctly, we should write the variable d0 to the
last word of the destination in this case.

This patch fixes the bug by introducing and extra test if first is zero.

The patch also removes the references to fb_memmove in the code that is
commented out because fb_memmove was removed from framebuffer subsystem.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/fbdev/core/cfbcopyarea.c