diff options
| author | Jordan Rose <jordan_rose@apple.com> | 2014-03-26 17:05:46 +0000 |
|---|---|---|
| committer | Jordan Rose <jordan_rose@apple.com> | 2014-03-26 17:05:46 +0000 |
| commit | 447549aa0bae6fe171214e1fcd8f330ff87aa9b0 (patch) | |
| tree | f5d167d9b79916c29a3afa011b29b4b9f9e90215 /lib/CodeGen/CGExpr.cpp | |
| parent | 972fd1d7f0289d95dd78c64a424f130be44ecffe (diff) | |
| download | clang-447549aa0bae6fe171214e1fcd8f330ff87aa9b0.tar.gz clang-447549aa0bae6fe171214e1fcd8f330ff87aa9b0.tar.bz2 clang-447549aa0bae6fe171214e1fcd8f330ff87aa9b0.tar.xz | |
[analyzer] Handle the M_ZERO and __GFP_ZERO flags in kernel mallocs.
Add M_ZERO awareness to malloc() static analysis in Clang for FreeBSD,
NetBSD, and OpenBSD in a similar fashion to O_CREAT for open(2).
These systems have a three-argument malloc() in the kernel where the
third argument contains flags; the M_ZERO flag will zero-initialize the
allocated buffer.
This should reduce the number of false positives when running static
analysis on BSD kernels.
Additionally, add kmalloc() (Linux kernel malloc()) and treat __GFP_ZERO
like M_ZERO on Linux.
Future work involves a better method of checking for named flags without
hardcoding values.
Patch by Conrad Meyer, with minor modifications by me.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204832 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
0 files changed, 0 insertions, 0 deletions
