Commit f928ac0a authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Linus Torvalds

atmel_lcdfb: disallow setting larger resolution than the framebuffer memory can handle

Signed-off-by: default avatarStanislaw Gruszka <stf_xl@wp.pl>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
Cc: Krzysztof Helt <krzysztof.h1@wp.pl>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 486ff387
...@@ -372,6 +372,13 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var, ...@@ -372,6 +372,13 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
var->transp.offset = var->transp.length = 0; var->transp.offset = var->transp.length = 0;
var->xoffset = var->yoffset = 0; var->xoffset = var->yoffset = 0;
if (info->fix.smem_len) {
unsigned int smem_len = (var->xres_virtual * var->yres_virtual
* ((var->bits_per_pixel + 7) / 8));
if (smem_len > info->fix.smem_len)
return -EINVAL;
}
/* Saturate vertical and horizontal timings at maximum values */ /* Saturate vertical and horizontal timings at maximum values */
var->vsync_len = min_t(u32, var->vsync_len, var->vsync_len = min_t(u32, var->vsync_len,
(ATMEL_LCDC_VPW >> ATMEL_LCDC_VPW_OFFSET) + 1); (ATMEL_LCDC_VPW >> ATMEL_LCDC_VPW_OFFSET) + 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment