linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Tom Gundersen <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, swarren@wwwdotorg.org,
	hpa@zytor.com, mingo@kernel.org, swarren@nvidia.com,
	geert@linux-m68k.org, tglx@linutronix.de, teg@jklm.no,
	dh.herrmann@gmail.com
Subject: [tip:x86/urgent] x86/simplefb: Fix overflow causing bogus fall-back
Date: Thu, 3 Oct 2013 06:59:33 -0700	[thread overview]
Message-ID: <tip-e33a29a5ae711162c6b6fefc0a2ef18f4a4254bf@git.kernel.org> (raw)
In-Reply-To: <1380644320-1026-1-git-send-email-teg@jklm.no>

Commit-ID:  e33a29a5ae711162c6b6fefc0a2ef18f4a4254bf
Gitweb:     http://git.kernel.org/tip/e33a29a5ae711162c6b6fefc0a2ef18f4a4254bf
Author:     Tom Gundersen <teg@jklm.no>
AuthorDate: Tue, 1 Oct 2013 18:18:40 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 2 Oct 2013 07:50:40 +0200

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: Tom Gundersen <teg@jklm.no>
Reviewed-by: David 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.no
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/sysfb_simplefb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/sysfb_simplefb.c b/arch/x86/kernel/sysfb_simplefb.c
index 22513e9..4ebd636 100644
--- a/arch/x86/kernel/sysfb_simplefb.c
+++ b/arch/x86/kernel/sysfb_simplefb.c
@@ -72,7 +72,7 @@ __init int create_simplefb(const struct screen_info *si,
 	 * the part that is occupied by the framebuffer */
 	len = mode->height * mode->stride;
 	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");
 		return -EINVAL;
 	}

  reply	other threads:[~2013-10-03 14:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-01 16:18 [PATCH v3] x86: simplefb: avoid overflow Tom Gundersen
2013-10-03 13:59 ` tip-bot for Tom Gundersen [this message]
2013-10-03 18:09   ` [tip:x86/urgent] x86/simplefb: Fix overflow causing bogus fall-back Geert Uytterhoeven
2013-10-04  6:26     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-e33a29a5ae711162c6b6fefc0a2ef18f4a4254bf@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=dh.herrmann@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=swarren@nvidia.com \
    --cc=swarren@wwwdotorg.org \
    --cc=teg@jklm.no \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).