Skip to content

Commit

Permalink
intel-agp: fix a panic with 1M of shared memory, no GTT entries
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Lubomir Rintel <[email protected]>
Cc: Dave Airlie <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
lkundrak authored and torvalds committed Mar 10, 2009
1 parent 229cc58 commit 9c1e8a4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/char/agp/intel-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,13 +633,15 @@ static void intel_i830_init_gtt_entries(void)
break;
}
}
if (gtt_entries > 0)
if (gtt_entries > 0) {
dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n",
gtt_entries / KB(1), local ? "local" : "stolen");
else
gtt_entries /= KB(4);
} else {
dev_info(&agp_bridge->dev->dev,
"no pre-allocated video memory detected\n");
gtt_entries /= KB(4);
gtt_entries = 0;
}

intel_private.gtt_entries = gtt_entries;
}
Expand Down

0 comments on commit 9c1e8a4

Please sign in to comment.