mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
atmel_lcdfb: disallow setting larger resolution than the framebuffer memory can handle
Signed-off-by: Stanislaw Gruszka <[email protected]> Acked-by: Nicolas Ferre <[email protected]> Cc: Krzysztof Helt <[email protected]> Cc: Haavard Skinnemoen <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
486ff387c0
commit
f928ac0a98
1 changed files with 7 additions and 0 deletions
|
|
@ -372,6 +372,13 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
|
|||
var->transp.offset = var->transp.length = 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 */
|
||||
var->vsync_len = min_t(u32, var->vsync_len,
|
||||
(ATMEL_LCDC_VPW >> ATMEL_LCDC_VPW_OFFSET) + 1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue