[PATCH] tgafb: fix copying overlapping areas
authorMaciej W. Rozycki <macro@linux-mips.org>
Mon, 12 Feb 2007 08:54:53 +0000 (00:54 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 12 Feb 2007 17:48:41 +0000 (09:48 -0800)
The direction of copying in the copyarea functions is selected incorrectly,
resulting in corruption.  This is a fix.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: James Simmons <jsimmons@infradead.org>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/tgafb.c

index 0a00a6cc7c2b9cf4d9463ed6e1a9df22d2b5464b..9c23a783e7139eefec0c1944d797218589fff72e 100644 (file)
@@ -885,7 +885,7 @@ copyarea_line_8bpp(struct fb_info *info, u32 dy, u32 sy,
 
        n64 = (height * width) / 64;
 
-       if (dy < sy) {
+       if (sy < dy) {
                spos = (sy + height) * width;
                dpos = (dy + height) * width;
 
@@ -933,7 +933,7 @@ copyarea_line_32bpp(struct fb_info *info, u32 dy, u32 sy,
 
        n16 = (height * width) / 16;
 
-       if (dy < sy) {
+       if (sy < dy) {
                src = tga_fb + (sy + height) * width * 4;
                dst = tga_fb + (dy + height) * width * 4;