aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-02-06 04:39:44 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:18 -0500
commite8973637bd49de225130f9c04ceb388d48969d98 (patch)
tree598aa995af584390fe3a1e0feb6280b8608272a0
parentc0d40335353e1c89c9c885e5af4d0be0f1a50483 (diff)
FB/S3C2410: check default_display parameter passed in platform data
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>
-rw-r--r--drivers/video/s3c2410fb.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index e63f536e9fed..71fa6edb5c47 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -817,6 +817,12 @@ static int __init s3c24xxfb_probe(struct platform_device *pdev,
817 return -EINVAL; 817 return -EINVAL;
818 } 818 }
819 819
820 if (mach_info->default_display >= mach_info->num_displays) {
821 dev_err(&pdev->dev, "default is %d but only %d displays\n",
822 mach_info->default_display, mach_info->num_displays);
823 return -EINVAL;
824 }
825
820 display = mach_info->displays + mach_info->default_display; 826 display = mach_info->displays + mach_info->default_display;
821 827
822 irq = platform_get_irq(pdev, 0); 828 irq = platform_get_irq(pdev, 0);