diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2009-03-10 15:55:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-10 18:55:11 -0400 |
commit | 9c1e8a4ebcc04226cb6f3a1bf1d72f4cafd6b089 (patch) | |
tree | 30a76767516304283f29d1997cd6a285e39d160a | |
parent | 229cc58ba2b5a83b0b55764c6cb98695c106238a (diff) |
intel-agp: fix a panic with 1M of shared memory, no GTT entries
When GTT size is equal to amount of video memory, the amount of GTT
entries is computed lower than zero, which is invalid and leads to
off-by-one error in intel_i915_configure()
Originally posted here:
http://bugzilla.kernel.org/show_bug.cgi?id=12539
http://bugzilla.redhat.com/show_bug.cgi?id=445592
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Cc: Lubomir Rintel <lkundrak@v3.sk>
Cc: Dave Airlie <airlied@linux.ie>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/char/agp/intel-agp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index c7714185f831..4373adb2119a 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -633,13 +633,15 @@ static void intel_i830_init_gtt_entries(void) | |||
633 | break; | 633 | break; |
634 | } | 634 | } |
635 | } | 635 | } |
636 | if (gtt_entries > 0) | 636 | if (gtt_entries > 0) { |
637 | dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n", | 637 | dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n", |
638 | gtt_entries / KB(1), local ? "local" : "stolen"); | 638 | gtt_entries / KB(1), local ? "local" : "stolen"); |
639 | else | 639 | gtt_entries /= KB(4); |
640 | } else { | ||
640 | dev_info(&agp_bridge->dev->dev, | 641 | dev_info(&agp_bridge->dev->dev, |
641 | "no pre-allocated video memory detected\n"); | 642 | "no pre-allocated video memory detected\n"); |
642 | gtt_entries /= KB(4); | 643 | gtt_entries = 0; |
644 | } | ||
643 | 645 | ||
644 | intel_private.gtt_entries = gtt_entries; | 646 | intel_private.gtt_entries = gtt_entries; |
645 | } | 647 | } |