• Jesper Juhl's avatar
    [media] Media, DVB, Siano, smsusb: Avoid static analysis report about 'use after free' · 08921ac9
    Jesper Juhl authored
    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: default avatarJesper Juhl <jj@chaosbits.net>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
    08921ac9
smsusb.c 15.2 KB