[PATCH] Fix possible null pointer dereference in s3c24xx_i2c_resume

Holger Freyther zecke at openmoko.org
Tue Jun 3 11:11:15 CEST 2008


From 0b9bae6aed5268707b348e48a01411ba420844e1 Mon Sep 17 00:00:00 2001
From: Holger Freyther <zecke at openmoko.org>
Date: Tue, 27 May 2008 14:41:35 +0200
Subject: [PATCH] [janitor] Fix possible null pointer dereference
     Judging by the control flow of the resume method i2c->suspended++ could
     lead to a null pointer dereference.

---
 drivers/i2c/busses/i2c-s3c2410.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c 
b/drivers/i2c/busses/i2c-s3c2410.c
index 5ac8309..bd69127 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -919,10 +919,10 @@ static int s3c24xx_i2c_resume(struct platform_device 
*dev)
 {
 	struct s3c24xx_i2c *i2c = platform_get_drvdata(dev);
 
-	if (i2c != NULL)
+	if (i2c != NULL) {
 		s3c24xx_i2c_init(i2c);
-
-	i2c->suspended--;
+		i2c->suspended--;
+	}
 
 	return 0;
 }
-- 
1.5.4.3





More information about the openmoko-kernel mailing list