aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2005-12-13 01:17:17 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-12-13 01:31:17 -0500
commit1207069f6f8f3d1b71641fdaa6cc04fca6fff9f5 (patch)
treec8be44eb73032dd787c18ff3f71d42083258484e /drivers/video
parent4743484718e1d710321f24f8ef7d0124a48291b3 (diff)
[PATCH] fbdev: Pan display fixes
- Fix fb_pan_display rejecting yoffsets that are valid if panning mode is ywrap. - Add more robust error checking in fb_pan_display specially since this function is accessible by userland apps. Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbmem.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 6240aedb4154..10dfdf035264 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -722,14 +722,30 @@ static void try_to_load(int fb)
722int 722int
723fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var) 723fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
724{ 724{
725 struct fb_fix_screeninfo *fix = &info->fix;
725 int xoffset = var->xoffset; 726 int xoffset = var->xoffset;
726 int yoffset = var->yoffset; 727 int yoffset = var->yoffset;
727 int err; 728 int err = 0, yres = info->var.yres;
729
730 if (var->yoffset > 0) {
731 if (var->vmode & FB_VMODE_YWRAP) {
732 if (!fix->ywrapstep || (var->yoffset % fix->ywrapstep))
733 err = -EINVAL;
734 else
735 yres = 0;
736 } else if (!fix->ypanstep || (var->yoffset % fix->ypanstep))
737 err = -EINVAL;
738 }
739
740 if (var->xoffset > 0 && (!fix->xpanstep ||
741 (var->xoffset % fix->xpanstep)))
742 err = -EINVAL;
743
744 if (err || !info->fbops->fb_pan_display || xoffset < 0 ||
745 yoffset < 0 || var->yoffset + yres > info->var.yres_virtual ||
746 var->xoffset + info->var.xres > info->var.xres_virtual)
747 return -EINVAL;
728 748
729 if (xoffset < 0 || yoffset < 0 || !info->fbops->fb_pan_display ||
730 xoffset + info->var.xres > info->var.xres_virtual ||
731 yoffset + info->var.yres > info->var.yres_virtual)
732 return -EINVAL;
733 if ((err = info->fbops->fb_pan_display(var, info))) 749 if ((err = info->fbops->fb_pan_display(var, info)))
734 return err; 750 return err;
735 info->var.xoffset = var->xoffset; 751 info->var.xoffset = var->xoffset;