malloc checker and kmalloc

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

malloc checker and kmalloc

suyash singh via cfe-dev
Hi,
I found a problematic case with the MallocChecker. The checker does not handle the malloc functions if it is inlined. In Linux kernel source code the "kmalloc" function seems to be inlined and it returns with a fixed value ((void*)16) ("ZERO_SIZE_PTR") (for my case at least) if a zero-sized block is allocated. When later this block is freed (with "kfree") a warning is reported about freeing of a constant address. In this case it is a false positive because the special value is allowed to be freed.
The problem is probably not easy to fix, specially allow to free a fixed value if it is the result of a (probably inlined) malloc call? 

Balázs

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev