Skip to content

Commit

Permalink
FB/S3C2410: check default_display parameter passed in platform data
Browse files Browse the repository at this point in the history
Ensure that the default display parameter passed in via the
device's platform data is valid. It turns out when mach-bast.c
was updated, the default_display was set outside of the display
array bounds, causing a panic on startup.

If the default_display is bigger than num_displays, then generate
an error and refuse to initialise the driver.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Vincent Sanders <vince@simtec.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Ben Dooks authored and Linus Torvalds committed Feb 6, 2008
1 parent c0d4033 commit e897363
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/video/s3c2410fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,12 @@ static int __init s3c24xxfb_probe(struct platform_device *pdev,
return -EINVAL;
}

if (mach_info->default_display >= mach_info->num_displays) {
dev_err(&pdev->dev, "default is %d but only %d displays\n",
mach_info->default_display, mach_info->num_displays);
return -EINVAL;
}

display = mach_info->displays + mach_info->default_display;

irq = platform_get_irq(pdev, 0);
Expand Down

0 comments on commit e897363

Please sign in to comment.