提交 e33a29a5 编写于 作者: T Tom Gundersen 提交者: Ingo Molnar

x86/simplefb: Fix overflow causing bogus fall-back

On my MacBook Air lfb_size is 4M, which makes the bitshit
overflow (to 256GB - larger than 32 bits), meaning we fall
back to efifb unnecessarily.

Cast to u64 to avoid the overflow.
Signed-off-by: NTom Gundersen <teg@jklm.no>
Reviewed-by: NDavid Herrmann <dh.herrmann@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Link: http://lkml.kernel.org/r/1380644320-1026-1-git-send-email-teg@jklm.noSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 669fc2f0
...@@ -72,7 +72,7 @@ __init int create_simplefb(const struct screen_info *si, ...@@ -72,7 +72,7 @@ __init int create_simplefb(const struct screen_info *si,
* the part that is occupied by the framebuffer */ * the part that is occupied by the framebuffer */
len = mode->height * mode->stride; len = mode->height * mode->stride;
len = PAGE_ALIGN(len); len = PAGE_ALIGN(len);
if (len > si->lfb_size << 16) { if (len > (u64)si->lfb_size << 16) {
printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n"); printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册