check_free_strict: New stricter cross function use after free check
commit9d67605695689906f01ec1163c2932549b062219
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 17 Jan 2018 19:57:26 +0000 (17 22:57 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Thu, 18 Jan 2018 10:11:26 +0000 (18 13:11 +0300)
tree88d8d7f718ddab232f996607c4efb26d06fda9d4
parent3387938185fed2c36fb53c93afe3cdf7b2977ef0
check_free_strict:  New stricter cross function use after free check

The normal check_frees_param.c records that a function frees a param if
every path through the function frees the param (or the param is NULL).
But there are other functions which maybe only free the param on error or
in certain paths through the function.  This is much more ambitious to
check for those cases, but it's what the check does.

The new check is kernel only because there are a lot of places where we
only free the last user.  The overwhelming most common way for the kernel
to determine the last user is by doing an atomic_inc() when we have a new
user and an atomic_dec() when the user is done.  This check looks for that
specifically so it would probably have a lot of false positives in
non-kernel code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
check_free.c
check_free_strict.c [copied from check_free.c with 83% similarity]
check_frees_param.c
check_frees_param_strict.c [new file with mode: 0644]
check_list.h
smatch_extra.h