diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2012-08-14 11:49:46 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-15 19:02:27 -0300 |
commit | e839776f9dfe1eda232755d5cab6eacc59208b4b (patch) | |
tree | c0c3e08fd6d77d429a9c04f49b7ace94965b7b94 /drivers/media/usb/tm6000 | |
parent | 89e47e35685535c16a20dc7b9cf8f969024232bc (diff) | |
download | blackbird-op-linux-e839776f9dfe1eda232755d5cab6eacc59208b4b.tar.gz blackbird-op-linux-e839776f9dfe1eda232755d5cab6eacc59208b4b.zip |
[media] drivers/media/usb/{s2255drv.c, tm6000/tm6000-alsa.c, tm6000/tm6000-input.c}: Remove potential NULL dereferences
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.Lawall@lip6.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb/tm6000')
-rw-r--r-- | drivers/media/usb/tm6000/tm6000-alsa.c | 3 | ||||
-rw-r--r-- | drivers/media/usb/tm6000/tm6000-input.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/usb/tm6000/tm6000-alsa.c b/drivers/media/usb/tm6000/tm6000-alsa.c index bd07ec707956..813c1ec53608 100644 --- a/drivers/media/usb/tm6000/tm6000-alsa.c +++ b/drivers/media/usb/tm6000/tm6000-alsa.c @@ -487,10 +487,11 @@ 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; diff --git a/drivers/media/usb/tm6000/tm6000-input.c b/drivers/media/usb/tm6000/tm6000-input.c index e80b7e190471..dffbd4bd47b1 100644 --- a/drivers/media/usb/tm6000/tm6000-input.c +++ b/drivers/media/usb/tm6000/tm6000-input.c @@ -319,12 +319,13 @@ static int tm6000_ir_change_protocol(struct rc_dev *rc, u64 rc_type) static int __tm6000_ir_int_start(struct rc_dev *rc) { struct tm6000_IR *ir = rc->priv; - struct tm6000_core *dev = ir->dev; + struct tm6000_core *dev; int pipe, size; int err = -ENOMEM; if (!ir) return -ENODEV; + dev = ir->dev; dprintk(2, "%s\n",__func__); |