diff options
author | Jesper Juhl <jj@chaosbits.net> | 2011-04-21 17:11:25 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 08:28:57 -0400 |
commit | 08921ac9e9d185d6f472238ea9c79a3a70eb7ea7 (patch) | |
tree | 2cdc6ad9191e6b601ef3fc5eedb67ec305cbbee0 /drivers/media | |
parent | 792bc09a9896dfbdac575ab4cdcd0f4db96d8ca1 (diff) |
[media] Media, DVB, Siano, smsusb: Avoid static analysis report about 'use after free'
In drivers/media/dvb/siano/smsusb.c we have this code:
...
kfree(dev);
sms_info("device %p destroyed", dev);
...
at least one static analysis tool (Coverity Prevent) complains about this
as a use-after-free bug.
While it's true that we do use the pointer variable after freeing it, the
only use is to print the value of the pointer, so there's not actually any
problem here. But still, silencing the complaint is trivial by just moving
the kfree() call below the sms_info(), so why not just do it?. It doesn't
change the workings of the code in any way, but it makes the tool shut up.
The patch below also removes a rather pointless blank line.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/siano/smsusb.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 0b8da57cf4c3..0c8164a2cc36 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c | |||
@@ -297,9 +297,8 @@ static void smsusb_term_device(struct usb_interface *intf) | |||
297 | if (dev->coredev) | 297 | if (dev->coredev) |
298 | smscore_unregister_device(dev->coredev); | 298 | smscore_unregister_device(dev->coredev); |
299 | 299 | ||
300 | kfree(dev); | ||
301 | |||
302 | sms_info("device %p destroyed", dev); | 300 | sms_info("device %p destroyed", dev); |
301 | kfree(dev); | ||
303 | } | 302 | } |
304 | 303 | ||
305 | usb_set_intfdata(intf, NULL); | 304 | usb_set_intfdata(intf, NULL); |