[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1282888640-27042-4-git-send-email-julia@diku.dk>
Date: Fri, 27 Aug 2010 07:57:20 +0200
From: Julia Lawall <julia@...u.dk>
To: Greg Kroah-Hartman <gregkh@...e.de>
Cc: kernel-janitors@...r.kernel.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 3/3] drivers/staging/tm6000: Remove potential NULL dereference
If the NULL test is necessary, the initialization involving a dereference of
the tested value should be moved after the NULL test.
The sematic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@
- T i = E->fld;
+ T i;
... when != E
when != i
if (E == NULL) S
+ i = E->fld;
// </smpl>
Signed-off-by: Julia Lawall <julia@...u.dk>
---
drivers/staging/tm6000/tm6000-alsa.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c
index 087137d..a06b3c6 100644
--- a/drivers/staging/tm6000/tm6000-alsa.c
+++ b/drivers/staging/tm6000/tm6000-alsa.c
@@ -426,11 +426,12 @@ error:
static int tm6000_audio_fini(struct tm6000_core *dev)
{
- struct snd_tm6000_card *chip = dev->adev;
+ struct snd_tm6000_card *chip;
if (!dev)
return 0;
+ chip = dev->adev;
if (!chip)
return 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists