Skip to content

Commit b714a62

Browse files
committed
Skip CheckMemoryRangeAvailability if !dry_run, as suggested by Vitaly
1 parent 0c878b6 commit b714a62

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler-rt/lib/msan/msan_linux.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ static bool InitShadow(bool init_origins, bool dry_run) {
147147
if (!map && !protect) {
148148
CHECK(type == MappingDesc::APP || type == MappingDesc::ALLOCATOR);
149149

150-
if (type == MappingDesc::ALLOCATOR &&
150+
if (dry_run && type == MappingDesc::ALLOCATOR &&
151151
!CheckMemoryRangeAvailability(start, size, !dry_run))
152152
return false;
153153
}
154154
if (map) {
155-
if (!CheckMemoryRangeAvailability(start, size, !dry_run))
155+
if (dry_run && !CheckMemoryRangeAvailability(start, size, !dry_run))
156156
return false;
157157
if (!dry_run &&
158158
!MmapFixedSuperNoReserve(start, size, kMemoryLayout[i].name))
@@ -161,7 +161,7 @@ static bool InitShadow(bool init_origins, bool dry_run) {
161161
DontDumpShadowMemory(start, size);
162162
}
163163
if (protect) {
164-
if (!CheckMemoryRangeAvailability(start, size, !dry_run))
164+
if (dry_run && !CheckMemoryRangeAvailability(start, size, !dry_run))
165165
return false;
166166
if (!dry_run && !ProtectMemoryRange(start, size, kMemoryLayout[i].name))
167167
return false;

0 commit comments

Comments
 (0)