[2.6 patch] drivers/video/s3fb.c: fix a use-before-check

From: Adrian Bunk
Date: Mon Mar 19 2007 - 05:26:48 EST


NULL checks should be before the first dereference.

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@xxxxxxxxx>

---
--- 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;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/