diff options
Diffstat (limited to 'drivers/video/via/viafbdev.c')
-rw-r--r-- | drivers/video/via/viafbdev.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index aa87529d7d6a..bddae58ecd8a 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c | |||
@@ -151,7 +151,8 @@ static void viafb_update_fix(struct fb_info *info) | |||
151 | 151 | ||
152 | info->fix.visual = | 152 | info->fix.visual = |
153 | bpp == 8 ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; | 153 | bpp == 8 ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; |
154 | info->fix.line_length = (info->var.xres_virtual * bpp / 8 + 7) & ~7; | 154 | info->fix.line_length = ALIGN(info->var.xres_virtual * bpp / 8, |
155 | VIA_PITCH_SIZE); | ||
155 | } | 156 | } |
156 | 157 | ||
157 | static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix, | 158 | static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix, |
@@ -238,8 +239,12 @@ static int viafb_check_var(struct fb_var_screeninfo *var, | |||
238 | depth = 24; | 239 | depth = 24; |
239 | 240 | ||
240 | viafb_fill_var_color_info(var, depth); | 241 | viafb_fill_var_color_info(var, depth); |
241 | line = (var->xres_virtual * var->bits_per_pixel / 8 + 7) & ~7; | 242 | if (var->xres_virtual < var->xres) |
242 | if (line * var->yres_virtual > ppar->memsize) | 243 | var->xres_virtual = var->xres; |
244 | |||
245 | line = ALIGN(var->xres_virtual * var->bits_per_pixel / 8, | ||
246 | VIA_PITCH_SIZE); | ||
247 | if (line > VIA_PITCH_MAX || line * var->yres_virtual > ppar->memsize) | ||
243 | return -EINVAL; | 248 | return -EINVAL; |
244 | 249 | ||
245 | /* Based on var passed in to calculate the refresh, | 250 | /* Based on var passed in to calculate the refresh, |