public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: Ondrej Zajicek <santiago@crfreenet.org>,
	James Simmons <jsimmons@infradead.org>,
	adaplas@gmail.com
Cc: linux-kernel@vger.kernel.org
Subject: [2.6 patch] drivers/video/s3fb.c: fix a use-before-check
Date: Mon, 19 Mar 2007 10:25:52 +0100	[thread overview]
Message-ID: <20070319092552.GP752@stusta.de> (raw)

NULL checks should be before the first dereference.

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>

---
--- linux-2.6.21-rc3-mm2/drivers/video/s3fb.c.old	2007-03-19 09:20:22.000000000 +0100
+++ linux-2.6.21-rc3-mm2/drivers/video/s3fb.c	2007-03-19 09:21:07.000000000 +0100
@@ -1000,11 +1000,12 @@ err_enable_device:
 static void __devexit s3_pci_remove(struct pci_dev *dev)
 {
 	struct fb_info *info = pci_get_drvdata(dev);
-	struct s3fb_info *par = info->par;
 
 	if (info) {
 
 #ifdef CONFIG_MTRR
+		struct s3fb_info *par = info->par;
+
 		if (par->mtrr_reg >= 0) {
 			mtrr_del(par->mtrr_reg, 0, 0);
 			par->mtrr_reg = -1;


             reply	other threads:[~2007-03-19  9:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-19  9:25 Adrian Bunk [this message]
2007-03-19 12:32 ` [2.6 patch] drivers/video/s3fb.c: fix a use-before-check Ondrej Zajicek

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=20070319092552.GP752@stusta.de \
    --to=bunk@stusta.de \
    --cc=adaplas@gmail.com \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=santiago@crfreenet.org \
    /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