diff options
Diffstat (limited to 'drivers/video/fbmem.c')
-rw-r--r-- | drivers/video/fbmem.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 9f180096c896..10dfdf035264 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -452,13 +452,17 @@ int fb_prepare_logo(struct fb_info *info, int rotate) | |||
452 | 452 | ||
453 | /* Return if no suitable logo was found */ | 453 | /* Return if no suitable logo was found */ |
454 | fb_logo.logo = fb_find_logo(depth); | 454 | fb_logo.logo = fb_find_logo(depth); |
455 | |||
456 | if (!fb_logo.logo) { | ||
457 | return 0; | ||
458 | } | ||
455 | 459 | ||
456 | if (rotate == FB_ROTATE_UR || rotate == FB_ROTATE_UD) | 460 | if (rotate == FB_ROTATE_UR || rotate == FB_ROTATE_UD) |
457 | yres = info->var.yres; | 461 | yres = info->var.yres; |
458 | else | 462 | else |
459 | yres = info->var.xres; | 463 | yres = info->var.xres; |
460 | 464 | ||
461 | if (fb_logo.logo && fb_logo.logo->height > yres) { | 465 | if (fb_logo.logo->height > yres) { |
462 | fb_logo.logo = NULL; | 466 | fb_logo.logo = NULL; |
463 | return 0; | 467 | return 0; |
464 | } | 468 | } |
@@ -718,14 +722,30 @@ static void try_to_load(int fb) | |||
718 | int | 722 | int |
719 | fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var) | 723 | fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var) |
720 | { | 724 | { |
725 | struct fb_fix_screeninfo *fix = &info->fix; | ||
721 | int xoffset = var->xoffset; | 726 | int xoffset = var->xoffset; |
722 | int yoffset = var->yoffset; | 727 | int yoffset = var->yoffset; |
723 | 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; | ||
724 | 748 | ||
725 | if (xoffset < 0 || yoffset < 0 || !info->fbops->fb_pan_display || | ||
726 | xoffset + info->var.xres > info->var.xres_virtual || | ||
727 | yoffset + info->var.yres > info->var.yres_virtual) | ||
728 | return -EINVAL; | ||
729 | if ((err = info->fbops->fb_pan_display(var, info))) | 749 | if ((err = info->fbops->fb_pan_display(var, info))) |
730 | return err; | 750 | return err; |
731 | info->var.xoffset = var->xoffset; | 751 | info->var.xoffset = var->xoffset; |