summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2019-09-12 02:20:36 +0000
committerVitaly Buka <vitalybuka@google.com>2019-09-12 02:20:36 +0000
commite51f24cf674f842be7e37e12bff99e22e21e5044 (patch)
treebc99ea3584e480b059ac2dd82d44d4c7fe290ef4
parentfe591a604ee75b90c3f628f522cb6928bca7b076 (diff)
downloadcompiler-rt-e51f24cf674f842be7e37e12bff99e22e21e5044.tar.gz
[compiler-rt] Remove some cpplint filters
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@371704 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/fuzzer/FuzzedDataProvider.h4
-rw-r--r--lib/asan/asan_malloc_win.cpp9
-rw-r--r--lib/asan/asan_report.cpp8
-rw-r--r--lib/asan/asan_rtems.cpp4
-rw-r--r--lib/asan/asan_scariness_score.h2
-rw-r--r--lib/asan/asan_thread.cpp3
-rw-r--r--lib/dfsan/dfsan.h2
-rw-r--r--lib/dfsan/dfsan_custom.cpp2
-rw-r--r--lib/interception/interception_win.cpp8
-rw-r--r--lib/lsan/lsan_common.cpp2
-rw-r--r--lib/msan/msan.h9
-rw-r--r--lib/sanitizer_common/sanitizer_common_interceptors.inc35
-rw-r--r--lib/sanitizer_common/sanitizer_flag_parser.cpp3
-rw-r--r--lib/sanitizer_common/sanitizer_flag_parser.h2
-rw-r--r--lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc2
-rw-r--r--lib/sanitizer_common/sanitizer_libc.cpp11
-rw-r--r--lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp5
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_report.cpp3
-rwxr-xr-xlib/sanitizer_common/scripts/check_lint.sh10
-rw-r--r--lib/sanitizer_common/tests/sanitizer_printf_test.cpp10
-rw-r--r--lib/sanitizer_common/tests/sanitizer_suppressions_test.cpp2
-rw-r--r--test/asan/TestCases/scariness_score_test.cpp4
22 files changed, 77 insertions, 63 deletions
diff --git a/include/fuzzer/FuzzedDataProvider.h b/include/fuzzer/FuzzedDataProvider.h
index 428db9a04..fd895b767 100644
--- a/include/fuzzer/FuzzedDataProvider.h
+++ b/include/fuzzer/FuzzedDataProvider.h
@@ -284,9 +284,9 @@ class FuzzedDataProvider {
// Avoid using implementation-defined unsigned to signer conversions.
// To learn more, see https://stackoverflow.com/questions/13150449.
- if (value <= std::numeric_limits<TS>::max())
+ if (value <= std::numeric_limits<TS>::max()) {
return static_cast<TS>(value);
- else {
+ } else {
constexpr auto TS_min = std::numeric_limits<TS>::min();
return TS_min + static_cast<char>(value - TS_min);
}
diff --git a/lib/asan/asan_malloc_win.cpp b/lib/asan/asan_malloc_win.cpp
index 9d107bee8..13c6f6521 100644
--- a/lib/asan/asan_malloc_win.cpp
+++ b/lib/asan/asan_malloc_win.cpp
@@ -528,10 +528,11 @@ void ReplaceSystemMalloc() {
(uptr)WRAP(RtlAllocateHeap),
(uptr *)&REAL(RtlAllocateHeap));
} else {
-#define INTERCEPT_UCRT_FUNCTION(func) \
- if (!INTERCEPT_FUNCTION_DLLIMPORT("ucrtbase.dll", \
- "api-ms-win-core-heap-l1-1-0.dll", func)) \
- VPrintf(2, "Failed to intercept ucrtbase.dll import %s\n", #func);
+#define INTERCEPT_UCRT_FUNCTION(func) \
+ if (!INTERCEPT_FUNCTION_DLLIMPORT( \
+ "ucrtbase.dll", "api-ms-win-core-heap-l1-1-0.dll", func)) { \
+ VPrintf(2, "Failed to intercept ucrtbase.dll import %s\n", #func); \
+ }
INTERCEPT_UCRT_FUNCTION(HeapAlloc);
INTERCEPT_UCRT_FUNCTION(HeapFree);
INTERCEPT_UCRT_FUNCTION(HeapReAlloc);
diff --git a/lib/asan/asan_report.cpp b/lib/asan/asan_report.cpp
index 5c16cb3e4..2e6ce436d 100644
--- a/lib/asan/asan_report.cpp
+++ b/lib/asan/asan_report.cpp
@@ -410,8 +410,12 @@ static bool IsInvalidPointerPair(uptr a1, uptr a2) {
static INLINE void CheckForInvalidPointerPair(void *p1, void *p2) {
switch (flags()->detect_invalid_pointer_pairs) {
- case 0 : return;
- case 1 : if (p1 == nullptr || p2 == nullptr) return; break;
+ case 0:
+ return;
+ case 1:
+ if (p1 == nullptr || p2 == nullptr)
+ return;
+ break;
}
uptr a1 = reinterpret_cast<uptr>(p1);
diff --git a/lib/asan/asan_rtems.cpp b/lib/asan/asan_rtems.cpp
index 360d5780a..ecd568c59 100644
--- a/lib/asan/asan_rtems.cpp
+++ b/lib/asan/asan_rtems.cpp
@@ -181,11 +181,11 @@ static void ThreadStartHook(void *hook, uptr os_id) {
asanThreadRegistry().GetThreadLocked(thread->tid())->status;
DCHECK(status == ThreadStatusCreated || status == ThreadStatusRunning);
// Determine whether we are starting or restarting the thread.
- if (status == ThreadStatusCreated)
+ if (status == ThreadStatusCreated) {
// In lieu of AsanThread::ThreadStart.
asanThreadRegistry().StartThread(thread->tid(), os_id, ThreadType::Regular,
nullptr);
- else {
+ } else {
// In a thread restart, a thread may resume execution at an
// arbitrary function entry point, with its stack and TLS state
// reset. We unpoison the stack in that case.
diff --git a/lib/asan/asan_scariness_score.h b/lib/asan/asan_scariness_score.h
index 9e7ba47d8..3932973c2 100644
--- a/lib/asan/asan_scariness_score.h
+++ b/lib/asan/asan_scariness_score.h
@@ -43,7 +43,7 @@ struct ScarinessScoreBase {
internal_strlcat(descr, "-", sizeof(descr));
internal_strlcat(descr, reason, sizeof(descr));
score += add_to_score;
- };
+ }
int GetScore() const { return score; }
const char *GetDescription() const { return descr; }
void Print() const {
diff --git a/lib/asan/asan_thread.cpp b/lib/asan/asan_thread.cpp
index c75cdc2bb..6734d9a16 100644
--- a/lib/asan/asan_thread.cpp
+++ b/lib/asan/asan_thread.cpp
@@ -367,8 +367,9 @@ uptr AsanThread::GetStackVariableShadowStart(uptr addr) {
} else if (has_fake_stack()) {
bottom = fake_stack()->AddrIsInFakeStack(addr);
CHECK(bottom);
- } else
+ } else {
return 0;
+ }
uptr aligned_addr = RoundDownTo(addr, SANITIZER_WORDSIZE / 8); // align addr.
u8 *shadow_ptr = (u8*)MemToShadow(aligned_addr);
diff --git a/lib/dfsan/dfsan.h b/lib/dfsan/dfsan.h
index df6847cdb..d66239121 100644
--- a/lib/dfsan/dfsan.h
+++ b/lib/dfsan/dfsan.h
@@ -38,7 +38,7 @@ dfsan_label dfsan_union(dfsan_label l1, dfsan_label l2);
} // extern "C"
template <typename T>
-void dfsan_set_label(dfsan_label label, T &data) {
+void dfsan_set_label(dfsan_label label, T &data) { // NOLINT
dfsan_set_label(label, (void *)&data, sizeof(T));
}
diff --git a/lib/dfsan/dfsan_custom.cpp b/lib/dfsan/dfsan_custom.cpp
index 78d12d7d6..84f0271b1 100644
--- a/lib/dfsan/dfsan_custom.cpp
+++ b/lib/dfsan/dfsan_custom.cpp
@@ -505,7 +505,7 @@ int __dfsw_getrusage(int who, struct rusage *usage, dfsan_label who_label,
SANITIZER_INTERFACE_ATTRIBUTE
char *__dfsw_strcpy(char *dest, const char *src, dfsan_label dst_label,
dfsan_label src_label, dfsan_label *ret_label) {
- char *ret = strcpy(dest, src);
+ char *ret = strcpy(dest, src); // NOLINT
if (ret) {
internal_memcpy(shadow_for(dest), shadow_for(src),
sizeof(dfsan_label) * (strlen(src) + 1));
diff --git a/lib/interception/interception_win.cpp b/lib/interception/interception_win.cpp
index b94e214fd..1a1c327e6 100644
--- a/lib/interception/interception_win.cpp
+++ b/lib/interception/interception_win.cpp
@@ -883,8 +883,8 @@ uptr InternalGetProcAddress(void *module, const char *func_name) {
// Check that the module header is full and present.
RVAPtr<IMAGE_DOS_HEADER> dos_stub(module, 0);
RVAPtr<IMAGE_NT_HEADERS> headers(module, dos_stub->e_lfanew);
- if (!module || dos_stub->e_magic != IMAGE_DOS_SIGNATURE || // "MZ"
- headers->Signature != IMAGE_NT_SIGNATURE || // "PE\0\0"
+ if (!module || dos_stub->e_magic != IMAGE_DOS_SIGNATURE || // "MZ"
+ headers->Signature != IMAGE_NT_SIGNATURE || // "PE\0\0"
headers->FileHeader.SizeOfOptionalHeader <
sizeof(IMAGE_OPTIONAL_HEADER)) {
return 0;
@@ -963,8 +963,8 @@ bool OverrideImportedFunction(const char *module_to_patch,
// Check that the module header is full and present.
RVAPtr<IMAGE_DOS_HEADER> dos_stub(module, 0);
RVAPtr<IMAGE_NT_HEADERS> headers(module, dos_stub->e_lfanew);
- if (!module || dos_stub->e_magic != IMAGE_DOS_SIGNATURE || // "MZ"
- headers->Signature != IMAGE_NT_SIGNATURE || // "PE\0\0"
+ if (!module || dos_stub->e_magic != IMAGE_DOS_SIGNATURE || // "MZ"
+ headers->Signature != IMAGE_NT_SIGNATURE || // "PE\0\0"
headers->FileHeader.SizeOfOptionalHeader <
sizeof(IMAGE_OPTIONAL_HEADER)) {
return false;
diff --git a/lib/lsan/lsan_common.cpp b/lib/lsan/lsan_common.cpp
index 529daee43..86bd120e7 100644
--- a/lib/lsan/lsan_common.cpp
+++ b/lib/lsan/lsan_common.cpp
@@ -535,7 +535,7 @@ static void ReportIfNotSuspended(ThreadContextBase *tctx, void *arg) {
if (i >= suspended_threads.size() || suspended_threads[i] != tctx->os_id)
Report("Running thread %d was not suspended. False leaks are possible.\n",
tctx->os_id);
- };
+ }
}
static void ReportUnsuspendedThreads(
diff --git a/lib/msan/msan.h b/lib/msan/msan.h
index b2bc14f36..12aeaa435 100644
--- a/lib/msan/msan.h
+++ b/lib/msan/msan.h
@@ -346,10 +346,11 @@ const int STACK_TRACE_TAG_POISON = StackTrace::TAG_CUSTOM + 1;
#define GET_STORE_STACK_TRACE \
GET_STORE_STACK_TRACE_PC_BP(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME())
-#define GET_FATAL_STACK_TRACE_PC_BP(pc, bp) \
- BufferedStackTrace stack; \
- if (msan_inited) \
- stack.Unwind(pc, bp, nullptr, common_flags()->fast_unwind_on_fatal)
+#define GET_FATAL_STACK_TRACE_PC_BP(pc, bp) \
+ BufferedStackTrace stack; \
+ if (msan_inited) { \
+ stack.Unwind(pc, bp, nullptr, common_flags()->fast_unwind_on_fatal); \
+ }
#define GET_FATAL_STACK_TRACE_HERE \
GET_FATAL_STACK_TRACE_PC_BP(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME())
diff --git a/lib/sanitizer_common/sanitizer_common_interceptors.inc b/lib/sanitizer_common/sanitizer_common_interceptors.inc
index fe992bf29..7ea896ef2 100644
--- a/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -3070,13 +3070,14 @@ INTERCEPTOR(int, sendmmsg, int fd, struct __sanitizer_mmsghdr *msgvec,
COMMON_INTERCEPTOR_FD_RELEASE(ctx, fd);
}
int res = REAL(sendmmsg)(fd, msgvec, vlen, flags);
- if (res >= 0 && msgvec)
+ if (res >= 0 && msgvec) {
for (int i = 0; i < res; ++i) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, &msgvec[i].msg_len,
sizeof(msgvec[i].msg_len));
if (common_flags()->intercept_send)
read_msghdr(ctx, &msgvec[i].msg_hdr, msgvec[i].msg_len);
}
+ }
return res;
}
#define INIT_SENDMMSG COMMON_INTERCEPT_FUNCTION(sendmmsg);
@@ -3207,20 +3208,21 @@ INTERCEPTOR(uptr, ptrace, int request, int pid, void *addr, void *data) {
__sanitizer_iovec local_iovec;
if (data) {
- if (request == ptrace_setregs)
+ if (request == ptrace_setregs) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, data, struct_user_regs_struct_sz);
- else if (request == ptrace_setfpregs)
+ } else if (request == ptrace_setfpregs) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, data, struct_user_fpregs_struct_sz);
- else if (request == ptrace_setfpxregs)
+ } else if (request == ptrace_setfpxregs) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, data, struct_user_fpxregs_struct_sz);
- else if (request == ptrace_setvfpregs)
+ } else if (request == ptrace_setvfpregs) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, data, struct_user_vfpregs_struct_sz);
- else if (request == ptrace_setsiginfo)
+ } else if (request == ptrace_setsiginfo) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, data, siginfo_t_sz);
+
// Some kernel might zero the iovec::iov_base in case of invalid
// write access. In this case copy the invalid address for further
// inspection.
- else if (request == ptrace_setregset || request == ptrace_getregset) {
+ } else if (request == ptrace_setregset || request == ptrace_getregset) {
__sanitizer_iovec *iovec = (__sanitizer_iovec*)data;
COMMON_INTERCEPTOR_READ_RANGE(ctx, iovec, sizeof(*iovec));
local_iovec = *iovec;
@@ -3237,19 +3239,19 @@ INTERCEPTOR(uptr, ptrace, int request, int pid, void *addr, void *data) {
if (!res && data) {
// Note that PEEK* requests assign different meaning to the return value.
// This function does not handle them (nor does it need to).
- if (request == ptrace_getregs)
+ if (request == ptrace_getregs) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, struct_user_regs_struct_sz);
- else if (request == ptrace_getfpregs)
+ } else if (request == ptrace_getfpregs) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, struct_user_fpregs_struct_sz);
- else if (request == ptrace_getfpxregs)
+ } else if (request == ptrace_getfpxregs) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, struct_user_fpxregs_struct_sz);
- else if (request == ptrace_getvfpregs)
+ } else if (request == ptrace_getvfpregs) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, struct_user_vfpregs_struct_sz);
- else if (request == ptrace_getsiginfo)
+ } else if (request == ptrace_getsiginfo) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, siginfo_t_sz);
- else if (request == ptrace_geteventmsg)
+ } else if (request == ptrace_geteventmsg) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, sizeof(unsigned long));
- else if (request == ptrace_getregset) {
+ } else if (request == ptrace_getregset) {
__sanitizer_iovec *iovec = (__sanitizer_iovec*)data;
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, iovec, sizeof(*iovec));
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, local_iovec.iov_base,
@@ -7842,10 +7844,11 @@ INTERCEPTOR(int, modctl, int operation, void *argp) {
if (iov)
COMMON_INTERCEPTOR_WRITE_RANGE(
ctx, iov->iov_base, Min(iov_len, iov->iov_len));
- } else if (operation == modctl_exists)
+ } else if (operation == modctl_exists) {
ret = REAL(modctl)(operation, argp);
- else
+ } else {
ret = REAL(modctl)(operation, argp);
+ }
return ret;
}
diff --git a/lib/sanitizer_common/sanitizer_flag_parser.cpp b/lib/sanitizer_common/sanitizer_flag_parser.cpp
index 4831814b6..1e2bc6652 100644
--- a/lib/sanitizer_common/sanitizer_flag_parser.cpp
+++ b/lib/sanitizer_common/sanitizer_flag_parser.cpp
@@ -83,8 +83,9 @@ void FlagParser::parse_flag(const char *env_option_name) {
Printf("%s: ERROR: expected '=' in %s\n", SanitizerToolName,
env_option_name);
Die();
- } else
+ } else {
fatal_error("expected '='");
+ }
}
char *name = ll_strndup(buf_ + name_start, pos_ - name_start);
diff --git a/lib/sanitizer_common/sanitizer_flag_parser.h b/lib/sanitizer_common/sanitizer_flag_parser.h
index b68e29cd9..c24ad2562 100644
--- a/lib/sanitizer_common/sanitizer_flag_parser.h
+++ b/lib/sanitizer_common/sanitizer_flag_parser.h
@@ -24,7 +24,7 @@ class FlagHandlerBase {
virtual bool Parse(const char *value) { return false; }
protected:
- ~FlagHandlerBase() {};
+ ~FlagHandlerBase() {}
};
template <typename T>
diff --git a/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc b/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
index 1ec73827b..03ef7c178 100644
--- a/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
+++ b/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
@@ -1404,7 +1404,7 @@ static void ioctl_table_fill() {
_(SNDCTL_DSP_SKIP, NONE, 0);
_(SNDCTL_DSP_SILENCE, NONE, 0);
#undef _
-}
+} // NOLINT
static bool ioctl_initialized = false;
diff --git a/lib/sanitizer_common/sanitizer_libc.cpp b/lib/sanitizer_common/sanitizer_libc.cpp
index 5c9d3a80c..4bc04b486 100644
--- a/lib/sanitizer_common/sanitizer_libc.cpp
+++ b/lib/sanitizer_common/sanitizer_libc.cpp
@@ -63,10 +63,11 @@ void *internal_memmove(void *dest, const void *src, uptr n) {
for (i = 0; i < signed_n; ++i)
d[i] = s[i];
} else {
- if (d > s && signed_n > 0)
- for (i = signed_n - 1; i >= 0 ; --i) {
+ if (d > s && signed_n > 0) {
+ for (i = signed_n - 1; i >= 0; --i) {
d[i] = s[i];
}
+ }
}
return dest;
}
@@ -270,9 +271,9 @@ bool mem_is_zero(const char *beg, uptr size) {
for (; aligned_beg < aligned_end; aligned_beg++)
all |= *aligned_beg;
// Epilogue.
- if ((char*)aligned_end >= beg)
- for (const char *mem = (char*)aligned_end; mem < end; mem++)
- all |= *mem;
+ if ((char *)aligned_end >= beg) {
+ for (const char *mem = (char *)aligned_end; mem < end; mem++) all |= *mem;
+ }
return all == 0;
}
diff --git a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
index b520dc8da..651d5056d 100644
--- a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
+++ b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
@@ -223,10 +223,11 @@ bool ThreadSuspender::SuspendAllThreads() {
case ThreadLister::Ok:
break;
}
- for (tid_t tid : threads)
+ for (tid_t tid : threads) {
if (SuspendThread(tid))
retry = true;
- };
+ }
+ }
return suspended_threads_list_.ThreadCount();
}
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_report.cpp b/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
index a8b449b03..d6699f3ed 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
+++ b/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
@@ -106,8 +106,9 @@ void ReportMmapWriteExec(int prot) {
if (StackTrace::WillUseFastUnwind(fast)) {
GetThreadStackTopAndBottom(false, &top, &bottom);
stack->Unwind(kStackTraceMax, pc, bp, nullptr, top, bottom, true);
- } else
+ } else {
stack->Unwind(kStackTraceMax, pc, 0, nullptr, 0, 0, false);
+ }
Printf("%s", d.Warning());
Report("WARNING: %s: writable-executable page usage\n", SanitizerToolName);
diff --git a/lib/sanitizer_common/scripts/check_lint.sh b/lib/sanitizer_common/scripts/check_lint.sh
index ecd61c07e..8c8fc33ee 100755
--- a/lib/sanitizer_common/scripts/check_lint.sh
+++ b/lib/sanitizer_common/scripts/check_lint.sh
@@ -17,15 +17,15 @@ fi
# Filters
# TODO: remove some of these filters
COMMON_LINT_FILTER=-build/include,-build/header_guard,-legal/copyright,-whitespace/comments,-readability/casting,\
--build/namespaces,-readability/braces,-build/c++11,-runtime/int
+-build/namespaces,-build/c++11,-runtime/int
COMMON_LIT_TEST_LINT_FILTER=-whitespace/indent,-whitespace/line_length,-runtime/arrays
ASAN_RTL_LINT_FILTER=${COMMON_LINT_FILTER}
-ASAN_TEST_LINT_FILTER=${COMMON_LINT_FILTER},-runtime/sizeof,-runtime/printf,-runtime/threadsafe_fn
+ASAN_TEST_LINT_FILTER=${COMMON_LINT_FILTER},-runtime/printf,-runtime/threadsafe_fn
ASAN_LIT_TEST_LINT_FILTER=${ASAN_TEST_LINT_FILTER},${COMMON_LIT_TEST_LINT_FILTER}
-TSAN_RTL_LINT_FILTER=${COMMON_LINT_FILTER}
+TSAN_RTL_LINT_FILTER=${COMMON_LINT_FILTER},-readability/braces
TSAN_TEST_LINT_FILTER=${TSAN_RTL_LINT_FILTER},-runtime/threadsafe_fn
TSAN_LIT_TEST_LINT_FILTER=${TSAN_TEST_LINT_FILTER},${COMMON_LIT_TEST_LINT_FILTER}
@@ -34,10 +34,10 @@ MSAN_RTL_LINT_FILTER=${COMMON_LINT_FILTER}
LSAN_RTL_LINT_FILTER=${COMMON_LINT_FILTER}
LSAN_LIT_TEST_LINT_FILTER=${LSAN_RTL_LINT_FILTER},${COMMON_LIT_TEST_LINT_FILTER}
-DFSAN_RTL_LINT_FILTER=${COMMON_LINT_FILTER},-runtime/printf,-runtime/references,-readability/function
+DFSAN_RTL_LINT_FILTER=${COMMON_LINT_FILTER}
SCUDO_RTL_LINT_FILTER=${COMMON_LINT_FILTER}
-COMMON_RTL_INC_LINT_FILTER=${COMMON_LINT_FILTER},-runtime/sizeof,-runtime/printf,-readability/fn_size
+COMMON_RTL_INC_LINT_FILTER=${COMMON_LINT_FILTER}
SANITIZER_INCLUDES_LINT_FILTER=${COMMON_LINT_FILTER}
diff --git a/lib/sanitizer_common/tests/sanitizer_printf_test.cpp b/lib/sanitizer_common/tests/sanitizer_printf_test.cpp
index d213d107c..956ed6545 100644
--- a/lib/sanitizer_common/tests/sanitizer_printf_test.cpp
+++ b/lib/sanitizer_common/tests/sanitizer_printf_test.cpp
@@ -33,7 +33,7 @@ TEST(Printf, Basic) {
TEST(Printf, OverflowStr) {
char buf[] = "123456789";
- uptr len = internal_snprintf(buf, 4, "%s", "abcdef");
+ uptr len = internal_snprintf(buf, 4, "%s", "abcdef"); // NOLINT
EXPECT_EQ(len, (uptr)6);
EXPECT_STREQ("abc", buf);
EXPECT_EQ(buf[3], 0);
@@ -47,7 +47,7 @@ TEST(Printf, OverflowStr) {
TEST(Printf, OverflowInt) {
char buf[] = "123456789";
- internal_snprintf(buf, 4, "%d", -123456789);
+ internal_snprintf(buf, 4, "%d", -123456789); // NOLINT
EXPECT_STREQ("-12", buf);
EXPECT_EQ(buf[3], 0);
EXPECT_EQ(buf[4], '5');
@@ -66,7 +66,7 @@ TEST(Printf, OverflowUint) {
} else {
val = (uptr)0x123456789ULL;
}
- internal_snprintf(buf, 4, "a%zx", val);
+ internal_snprintf(buf, 4, "a%zx", val); // NOLINT
EXPECT_STREQ("a12", buf);
EXPECT_EQ(buf[3], 0);
EXPECT_EQ(buf[4], '5');
@@ -85,7 +85,7 @@ TEST(Printf, OverflowPtr) {
} else {
p = (void*)0x123456789ULL;
}
- internal_snprintf(buf, 4, "%p", p);
+ internal_snprintf(buf, 4, "%p", p); // NOLINT
EXPECT_STREQ("0x0", buf);
EXPECT_EQ(buf[3], 0);
EXPECT_EQ(buf[4], '5');
@@ -149,7 +149,7 @@ TEST(Printf, Precision) {
EXPECT_STREQ("12345 ", buf);
// Check that width does not overflow the smaller buffer, although
// 10 chars is requested, it stops at the buffer size, 8.
- len = internal_snprintf(buf, 8, "%-10s", "12345");
+ len = internal_snprintf(buf, 8, "%-10s", "12345"); // NOLINT
EXPECT_EQ(10U, len); // The required size reported.
EXPECT_STREQ("12345 ", buf);
}
diff --git a/lib/sanitizer_common/tests/sanitizer_suppressions_test.cpp b/lib/sanitizer_common/tests/sanitizer_suppressions_test.cpp
index 6fce03a57..50a6ce92f 100644
--- a/lib/sanitizer_common/tests/sanitizer_suppressions_test.cpp
+++ b/lib/sanitizer_common/tests/sanitizer_suppressions_test.cpp
@@ -18,7 +18,7 @@ namespace __sanitizer {
static bool MyMatch(const char *templ, const char *func) {
char tmp[1024];
- strcpy(tmp, templ);
+ snprintf(tmp, sizeof(tmp), "%s", templ);
return TemplateMatch(tmp, func);
}
diff --git a/test/asan/TestCases/scariness_score_test.cpp b/test/asan/TestCases/scariness_score_test.cpp
index fb174eb52..b60122541 100644
--- a/test/asan/TestCases/scariness_score_test.cpp
+++ b/test/asan/TestCases/scariness_score_test.cpp
@@ -155,9 +155,9 @@ int main(int argc, char **argv) {
case 10: StackBufferOverflow<char>(0, Write); break;
case 11: StackBufferOverflow<int64_t>(0, Read); break;
case 12:
- if (scale <= 3)
+ if (scale <= 3) {
StackBufferOverflow<int>(16, Write);
- else {
+ } else {
// At large shadow granularity, there is not enough redzone
// between stack elements to detect far-from-bounds. Pretend
// that this test passes.