Skip to content

Commit 2e26762

Browse files
committed
Add a DCHECK adhering to the suggestion
1 parent 5d8750f commit 2e26762

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,13 +669,13 @@ void MemoryAccessRangeT(ThreadState* thr, uptr pc, uptr addr, uptr size) {
669669
RawShadow* shadow_mem = MemToShadow(addr);
670670
DPrintf2("#%d: MemoryAccessRange: @%p %p size=%d is_read=%d\n", thr->tid,
671671
(void*)pc, (void*)addr, (int)size, is_read);
672-
672+
DCHECK_NE(size, 0);
673673
#if SANITIZER_DEBUG
674674
if (!IsAppMem(addr)) {
675675
Printf("Access to non app mem start: %p\n", (void*)addr);
676676
DCHECK(IsAppMem(addr));
677677
}
678-
if (size > 0 && !IsAppMem(addr + size - 1)) {
678+
if (!IsAppMem(addr + size - 1)) {
679679
Printf("Access to non app mem end: %p\n", (void*)(addr + size - 1));
680680
DCHECK(IsAppMem(addr + size - 1));
681681
}
@@ -686,7 +686,7 @@ void MemoryAccessRangeT(ThreadState* thr, uptr pc, uptr addr, uptr size) {
686686

687687
RawShadow* shadow_mem_end = reinterpret_cast<RawShadow*>(
688688
reinterpret_cast<uptr>(shadow_mem) + size * kShadowMultiplier - 1);
689-
if (size > 0 && !IsShadowMem(shadow_mem_end)) {
689+
if (!IsShadowMem(shadow_mem_end)) {
690690
Printf("Bad shadow end addr: %p (%p)\n", shadow_mem_end,
691691
(void*)(addr + size - 1));
692692
Printf(

0 commit comments

Comments
 (0)