* [2.6 patch] drivers/rtc/rtc-rs5c372.c: fix a NULL dereference
@ 2006-11-17 14:21 Adrian Bunk
0 siblings, 0 replies; only message in thread
From: Adrian Bunk @ 2006-11-17 14:21 UTC (permalink / raw)
To: Pavel Mironchik; +Cc: a.zummo, linux-kernel
The correct order is: NULL check before dereference
This was a guaranteed NULL dereference with debugging enabled since
rs5c372_sysfs_show_osc() does actually pass NULL...
Spotted by the Coverity checker.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
--- linux-2.6.19-rc5-mm2/drivers/rtc/rtc-rs5c372.c.old 2006-11-17 14:15:53.000000000 +0100
+++ linux-2.6.19-rc5-mm2/drivers/rtc/rtc-rs5c372.c 2006-11-17 14:16:53.000000000 +0100
@@ -126,13 +126,13 @@ static int rs5c372_get_trim(struct i2c_c
return -EIO;
}
- dev_dbg(&client->dev, "%s: raw trim=%x\n", __FUNCTION__, *trim);
-
if (osc)
*osc = (buf & RS5C372_TRIM_XSL) ? 32000 : 32768;
- if (trim)
+ if (trim) {
*trim = buf & RS5C372_TRIM_MASK;
+ dev_dbg(&client->dev, "%s: raw trim=%x\n", __FUNCTION__, *trim);
+ }
return 0;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-11-17 14:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-17 14:21 [2.6 patch] drivers/rtc/rtc-rs5c372.c: fix a NULL dereference Adrian Bunk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.