]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/video/amifb.c
amifb: test virtual screen range before subtraction on unsigned
[linux-2.6-omap-h63xx.git] / drivers / video / amifb.c
index 05a328c11a8bf17b7bd6178841caf546644c1639..0c549aa1cf87fc306e20e00e8dab38f08c885ff5 100644 (file)
@@ -2048,13 +2048,16 @@ static void amifb_copyarea(struct fb_info *info,
        width = x2 - dx;
        height = y2 - dy;
 
+       if (area->sx + dx < area->dx || area->sy + dy < area->dy)
+               return;
+
        /* update sx,sy */
        sx = area->sx + (dx - area->dx);
        sy = area->sy + (dy - area->dy);
 
        /* the source must be completely inside the virtual screen */
-       if (sx < 0 || sy < 0 || (sx + width) > info->var.xres_virtual ||
-           (sy + height) > info->var.yres_virtual)
+       if (sx + width > info->var.xres_virtual ||
+                       sy + height > info->var.yres_virtual)
                return;
 
        if (dy > sy || (dy == sy && dx > sx)) {
@@ -2383,6 +2386,9 @@ default_chipset:
                goto amifb_error;
        }
 
+       fb_videomode_to_modelist(ami_modedb, NUM_TOTAL_MODES,
+                                &fb_info.modelist);
+
        round_down_bpp = 0;
        chipptr = chipalloc(fb_info.fix.smem_len+
                            SPRITEMEMSIZE+