[PATCH] D42645: New simple Checker for mmap calls
Jonathan Roelofs via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 29 08:56:20 PST 2018
jroelofs added inline comments.
================
Comment at: lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp:1
+// MmapWriteExecChecker.cpp - Check for the prot argument
+//
----------------
jroelofs wrote:
> Needs one of these at the top:
>
> ```
> //===- MmapWriteExecChecker.cpp - Check the mmap prot argument ---------------*- C++ -*-===//
> ```
>
> Appropriately fitted to 80-cols.
The format of the first line is important because some people's syntax highlighters rely on it.
================
Comment at: lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp:29
+class MmapWriteExecChecker : public Checker<check::PostStmt<CallExpr>> {
+#ifdef __GLIBC__
+ static const int ProtWrite = 0x02;
----------------
This makes the checker's behavior depend on whether the host was built against glibc, however the target might not be the same as the host. You'll need to check the target's defines at checker-run-time, and not hardcode this.
Repository:
rC Clang
https://reviews.llvm.org/D42645
More information about the cfe-commits
mailing list