[compiler-rt] bafe3a4 - [NFC][tsan] Fix `reallocarray`, `calloc` parameters order
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 15 17:02:39 PDT 2024
Author: Vitaly Buka
Date: 2024-09-15T17:02:28-07:00
New Revision: bafe3a4b0ca0e9294a18a9ec4fea8567cb98dabe
URL: https://github.com/llvm/llvm-project/commit/bafe3a4b0ca0e9294a18a9ec4fea8567cb98dabe
DIFF: https://github.com/llvm/llvm-project/commit/bafe3a4b0ca0e9294a18a9ec4fea8567cb98dabe.diff
LOG: [NFC][tsan] Fix `reallocarray`, `calloc` parameters order
Implementation is commutative, so it should make
no difference. It's done just for consistency with
documentation.
Added:
Modified:
compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
compiler-rt/lib/tsan/rtl/tsan_mman.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
index 1be65bc99b260d..460cbacf3408cf 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
@@ -678,12 +678,12 @@ TSAN_INTERCEPTOR(void*, __libc_memalign, uptr align, uptr sz) {
return user_memalign(thr, pc, align, sz);
}
-TSAN_INTERCEPTOR(void*, calloc, uptr size, uptr n) {
+TSAN_INTERCEPTOR(void *, calloc, uptr n, uptr size) {
if (in_symbolizer())
- return InternalCalloc(size, n);
+ return InternalCalloc(n, size);
void *p = 0;
{
- SCOPED_INTERCEPTOR_RAW(calloc, size, n);
+ SCOPED_INTERCEPTOR_RAW(calloc, n, size);
p = user_calloc(thr, pc, size, n);
}
invoke_malloc_hook(p, n * size);
@@ -703,13 +703,13 @@ TSAN_INTERCEPTOR(void*, realloc, void *p, uptr size) {
return p;
}
-TSAN_INTERCEPTOR(void*, reallocarray, void *p, uptr size, uptr n) {
+TSAN_INTERCEPTOR(void *, reallocarray, void *p, uptr n, uptr size) {
if (in_symbolizer())
- return InternalReallocArray(p, size, n);
+ return InternalReallocArray(p, n, size);
if (p)
invoke_free_hook(p);
{
- SCOPED_INTERCEPTOR_RAW(reallocarray, p, size, n);
+ SCOPED_INTERCEPTOR_RAW(reallocarray, p, n, size);
p = user_reallocarray(thr, pc, p, size, n);
}
invoke_malloc_hook(p, size);
diff --git a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
index 0705365d77427d..0ea83fb3b59820 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
@@ -252,7 +252,7 @@ void *user_reallocarray(ThreadState *thr, uptr pc, void *p, uptr size, uptr n) {
if (AllocatorMayReturnNull())
return SetErrnoOnNull(nullptr);
GET_STACK_TRACE_FATAL(thr, pc);
- ReportReallocArrayOverflow(size, n, &stack);
+ ReportReallocArrayOverflow(n, size, &stack);
}
return user_realloc(thr, pc, p, size * n);
}
More information about the llvm-commits
mailing list