]> git.baikalelectronics.ru Git - kernel.git/commit
[media] Media, DVB, Siano, smsusb: Avoid static analysis report about 'use after...
authorJesper Juhl <jj@chaosbits.net>
Thu, 21 Apr 2011 21:11:25 +0000 (18:11 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 20 May 2011 12:28:57 +0000 (09:28 -0300)
commitc6b6576a06b2af43a2163088693203e3a15f31c4
tree2cdc6ad9191e6b601ef3fc5eedb67ec305cbbee0
parentb79b60fade99c67e3a4b0c7a06e7b3000172cafb
[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>
drivers/media/dvb/siano/smsusb.c