public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] drivers/video/s3fb.c: fix a use-before-check
@ 2007-03-19  9:25 Adrian Bunk
  2007-03-19 12:32 ` Ondrej Zajicek
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2007-03-19  9:25 UTC (permalink / raw)
  To: Ondrej Zajicek, James Simmons, adaplas; +Cc: linux-kernel

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;


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [2.6 patch] drivers/video/s3fb.c: fix a use-before-check
  2007-03-19  9:25 [2.6 patch] drivers/video/s3fb.c: fix a use-before-check Adrian Bunk
@ 2007-03-19 12:32 ` Ondrej Zajicek
  0 siblings, 0 replies; 2+ messages in thread
From: Ondrej Zajicek @ 2007-03-19 12:32 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Ondrej Zajicek, James Simmons, adaplas, linux-kernel

On Mon, Mar 19, 2007 at 10:25:52AM +0100, Adrian Bunk wrote:
> NULL checks should be before the first dereference.
> 
> Spotted by the Coverity checker.
> 
> Signed-off-by: Adrian Bunk <bunk@stusta.de>

Acked-by: Ondrej Zajicek <santiago@crfreenet.org>

-- 
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: santiago@mail.cz, jabber: santiago@njs.netlab.cz)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-03-19 12:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-19  9:25 [2.6 patch] drivers/video/s3fb.c: fix a use-before-check Adrian Bunk
2007-03-19 12:32 ` Ondrej Zajicek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox