Skip to content

Commit bafe3a4

Browse files
committed
[NFC][tsan] Fix reallocarray, calloc parameters order
Implementation is commutative, so it should make no difference. It's done just for consistency with documentation.
1 parent 2531b46 commit bafe3a4

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -678,12 +678,12 @@ TSAN_INTERCEPTOR(void*, __libc_memalign, uptr align, uptr sz) {
678678
return user_memalign(thr, pc, align, sz);
679679
}
680680

681-
TSAN_INTERCEPTOR(void*, calloc, uptr size, uptr n) {
681+
TSAN_INTERCEPTOR(void *, calloc, uptr n, uptr size) {
682682
if (in_symbolizer())
683-
return InternalCalloc(size, n);
683+
return InternalCalloc(n, size);
684684
void *p = 0;
685685
{
686-
SCOPED_INTERCEPTOR_RAW(calloc, size, n);
686+
SCOPED_INTERCEPTOR_RAW(calloc, n, size);
687687
p = user_calloc(thr, pc, size, n);
688688
}
689689
invoke_malloc_hook(p, n * size);
@@ -703,13 +703,13 @@ TSAN_INTERCEPTOR(void*, realloc, void *p, uptr size) {
703703
return p;
704704
}
705705

706-
TSAN_INTERCEPTOR(void*, reallocarray, void *p, uptr size, uptr n) {
706+
TSAN_INTERCEPTOR(void *, reallocarray, void *p, uptr n, uptr size) {
707707
if (in_symbolizer())
708-
return InternalReallocArray(p, size, n);
708+
return InternalReallocArray(p, n, size);
709709
if (p)
710710
invoke_free_hook(p);
711711
{
712-
SCOPED_INTERCEPTOR_RAW(reallocarray, p, size, n);
712+
SCOPED_INTERCEPTOR_RAW(reallocarray, p, n, size);
713713
p = user_reallocarray(thr, pc, p, size, n);
714714
}
715715
invoke_malloc_hook(p, size);

compiler-rt/lib/tsan/rtl/tsan_mman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void *user_reallocarray(ThreadState *thr, uptr pc, void *p, uptr size, uptr n) {
252252
if (AllocatorMayReturnNull())
253253
return SetErrnoOnNull(nullptr);
254254
GET_STACK_TRACE_FATAL(thr, pc);
255-
ReportReallocArrayOverflow(size, n, &stack);
255+
ReportReallocArrayOverflow(n, size, &stack);
256256
}
257257
return user_realloc(thr, pc, p, size * n);
258258
}

0 commit comments

Comments
 (0)