From: Julia Lawall <julia@diku.dk>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: kernel-janitors@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] drivers/staging/tm6000: Remove potential NULL dereference
Date: Fri, 27 Aug 2010 07:57:20 +0200 [thread overview]
Message-ID: <1282888640-27042-4-git-send-email-julia@diku.dk> (raw)
In-Reply-To: <1282888640-27042-1-git-send-email-julia@diku.dk>
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@diku.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;
prev parent reply other threads:[~2010-08-27 5:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-27 5:57 [PATCH 0/3] " Julia Lawall
2010-08-27 5:57 ` [PATCH 1/3] drivers/media/video/em28xx: " Julia Lawall
2010-08-27 5:57 ` [PATCH 2/3] drivers/dma: " Julia Lawall
2010-08-27 5:57 ` Julia Lawall [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1282888640-27042-4-git-send-email-julia@diku.dk \
--to=julia@diku.dk \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®