Re: smatch update / 2.5.64 / kbugs.org

From: Oleg Drokin (green@namesys.com)
Date: Fri Mar 14 2003 - 03:25:15 EST


Hello!

On Fri, Mar 07, 2003 at 09:53:07AM +0300, Oleg Drokin wrote:

> Actually I think these free() checks can be extended a lot, it can detect memory leaks and so on.

Ok, it took me awhile, but here is much extended version of unfree checker.
Now the biggest source of false positives is assignments to global variables and to arrays
I have more complete list of problematic places at beginning of the script, in case anyone
want to enhance it. Also it should now work with userspace code.
<shameless plug>Funnily enough, even though I started to work on this script hoping to find some
deeply hidden bugs in reiserfs, I ended up finding bugs in other filesystems instead ;)</shameless plug>

It also requires this function in smatch.pm (I see that now you have changed set_state() to allow empty
second argument, so it may be not that strictly needed now).
sub reset_state {
    my $name;
    my $i;

    $name = $_[0];

    foreach $state (@states){
        my $quotedname = quotemeta $name;
        my $temp = pop(@states);
        if ($state->{name} =~ /^$quotedname$/){
            $state->{state} = 0;
            $state->{start_line} = 0;
            return;
        }
        push @states, $temp;
    }
}

Bye,
    Oleg



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Mar 15 2003 - 22:00:38 EST