linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ben@fluff.org.uk
To: Linux FB <linux-fbdev-devel@lists.sourceforge.net>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Vincent Sanders <vince@simtec.co.uk>,
	Ben Dooks <ben-linux@fluff.org>
Subject: [patch 5/5] FB/S3C2410: Check default_display parameter passed in platform data
Date: Wed, 30 Jan 2008 01:30:16 +0000	[thread overview]
Message-ID: <20080130013106.527995260@fluff.org.uk> (raw)
In-Reply-To: 20080130013011.604188602@fluff.org.uk

[-- Attachment #1: simtec/simtec-drivers-fb-s3c2410-check-default-display.patch --]
[-- Type: text/plain, Size: 1323 bytes --]

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>

Index: linux-2.6.23-quilt5/drivers/video/s3c2410fb.c
===================================================================
--- linux-2.6.23-quilt5.orig/drivers/video/s3c2410fb.c
+++ linux-2.6.23-quilt5/drivers/video/s3c2410fb.c
@@ -817,6 +817,12 @@ static int __init s3c24xxfb_probe(struct
 		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);

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

      parent reply	other threads:[~2008-01-30  1:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-30  1:30 [patch 0/5] SM501 and S3C24XX framebuffer updates ben
2008-01-30  1:30 ` [patch 1/5] FB/SM501: Ensure console suspended before saving state ben
2008-01-30  1:30 ` [patch 2/5] FB/S3C2412: Add S3C2412 support to S3C2410 fb driver ben
2008-01-30  1:30 ` [patch 3/5] FB/S3C2410: Update debugging in S3C2410 framebuffer driver ben
2008-01-30  1:30 ` [patch 4/5] FB/S3C2410: Ensure S3C2410 framebuffer clears initial memory to black ben
2008-01-30  1:30 ` ben [this message]

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=20080130013106.527995260@fluff.org.uk \
    --to=ben@fluff.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=ben-linux@fluff.org \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=vince@simtec.co.uk \
    /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).