[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-30 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGdcc04e09cf6e: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR. (authored by balazske). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-27 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus accepted this revision. Szelethus added a comment. LGTM, thanks! Comment at: clang/test/Analysis/kmalloc-linux-1.c:1 +// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=unix.Malloc -verify %s + Oh, I almost forgot, the `core`

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-27 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 253163. balazske added a comment. - Removed test file malloc-linux-1.c - Prevent warning only if "malloc family" free is done (Do not recognize `ZERO_SIZE_PTR` at a `delete` call.) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-27 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 253088. balazske added a comment. Applied the code reformattings. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76830/new/ https://reviews.llvm.org/D76830 Files:

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-27 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus accepted this revision. Szelethus marked 2 inline comments as done. Szelethus added a comment. LGTM! Mind that I just published D76917 , you can, if you prefer, rebase on top of that. Also, a test case for `delete`ing a `ZERO_SIZE_PTR` valued pointer

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-27 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added inline comments. Comment at: clang/test/Analysis/kmalloc-linux-1.c:15 + +// FIXME: malloc checker expects kfree with 2 arguments, is this correct? +// (recent kernel source code contains a `kfree(const void *)`) balazske wrote: > Szelethus wrote:

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-27 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang/test/Analysis/kmalloc-linux-1.c:15 + +// FIXME: malloc checker expects kfree with 2 arguments, is this correct? +// (recent kernel source code contains a `kfree(const void *)`)

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-27 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 253066. balazske added a comment. Checking for the macro value only if no memory region was found. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76830/new/ https://reviews.llvm.org/D76830 Files:

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-27 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1687 + if (ArgValKnown) { +if (!KernelZeroSizePtrValue) + KernelZeroSizePtrValue = Szelethus wrote: > balazske

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-27 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1687 + if (ArgValKnown) { +if (!KernelZeroSizePtrValue) + KernelZeroSizePtrValue = balazske wrote: > Szelethus wrote: > > Szelethus wrote: > > > martong

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-27 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1687 + if (ArgValKnown) { +if (!KernelZeroSizePtrValue) + KernelZeroSizePtrValue = Szelethus wrote: > Szelethus

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1687 + if (ArgValKnown) { +if (!KernelZeroSizePtrValue) + KernelZeroSizePtrValue = Szelethus wrote: > martong wrote: > > balazske wrote: > > > martong

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added inline comments. Comment at: clang/test/Analysis/kmalloc-linux-1.c:15 + +// FIXME: malloc checker expects kfree with 2 arguments, is this correct? +// (recent kernel source code contains a `kfree(const void *)`) balazske wrote: > Szelethus wrote:

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang/test/Analysis/kmalloc-linux-1.c:15 + +// FIXME: malloc checker expects kfree with 2 arguments, is this correct? +// (recent kernel source code contains a `kfree(const void *)`)

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment. In D76830#1943133 , @balazske wrote: > FIXME: There is a test file "kmalloc-linux.c" but it seems to be > non-maintained and buggy (has no //-verify// option so it passes always but > produces multiple warnings). Crap, even

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. Herald added a subscriber: rnkovacs. LGTM! Comment at: clang/test/Analysis/kmalloc-linux-1.c:15 + +// FIXME: malloc checker expects kfree with 2 arguments, is this

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 252804. balazske added a comment. Improved documentation and handling of `KernelZeroSizePtrValue`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76830/new/ https://reviews.llvm.org/D76830 Files:

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:396 + /// yes was the value obtained or not. + mutable Optional> KernelZeroSizePtrValue; + martong wrote: > balazske

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:396 + /// yes was the value obtained or not. + mutable Optional> KernelZeroSizePtrValue; + balazske wrote: > martong wrote: > > Which one is referred to the lazy

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1687 + if (ArgValKnown) { +if (!KernelZeroSizePtrValue) + KernelZeroSizePtrValue = balazske wrote: > martong wrote: > > martong wrote: > > > This is a bit

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked 2 inline comments as done. balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:396 + /// yes was the value obtained or not. + mutable Optional> KernelZeroSizePtrValue; + martong wrote: > Which one is

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1687 + if (ArgValKnown) { +if (!KernelZeroSizePtrValue) + KernelZeroSizePtrValue = martong wrote: > This is a bit confusing for me. Perhaps alternatively we

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:396 + /// yes was the value obtained or not. + mutable Optional> KernelZeroSizePtrValue; + Which one is referred to the lazy initialization? The inner or the outer?

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision. Herald added subscribers: cfe-commits, ASDenysPetrov, martong, Charusso, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: clang. balazske added

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. FIXME: There is a test file "kmalloc-linux.c" but it seems to be non-maintained and buggy (has no //-verify// option so it passes always but produces multiple warnings). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp:146 return IntValue.getSExtValue(); } The function was changed to get the numeric value from the end of the macro in