Skip to content

Commit 8062b16

Browse files
Revert "[NFC] Fix CodeQL violations in compiler-rt. (#157793)" (#157913)
This reverts commit b44e6e0.
1 parent 1cacc73 commit 8062b16

File tree

5 files changed

+19
-21
lines changed

5 files changed

+19
-21
lines changed

compiler-rt/lib/dfsan/dfsan.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,8 +1128,7 @@ static bool CheckMemoryRangeAvailability(uptr beg, uptr size, bool verbose) {
11281128
uptr end = beg + size - 1;
11291129
if (!MemoryRangeIsAvailable(beg, end)) {
11301130
if (verbose)
1131-
Printf("FATAL: Memory range %p - %p is not available.\n", (void*)beg,
1132-
(void*)end);
1131+
Printf("FATAL: Memory range %p - %p is not available.\n", beg, end);
11331132
return false;
11341133
}
11351134
}
@@ -1151,8 +1150,8 @@ static bool ProtectMemoryRange(uptr beg, uptr size, const char *name) {
11511150
}
11521151
if ((uptr)addr != beg) {
11531152
uptr end = beg + size - 1;
1154-
Printf("FATAL: Cannot protect memory range %p - %p (%s).\n", (void*)beg,
1155-
(void*)end, name);
1153+
Printf("FATAL: Cannot protect memory range %p - %p (%s).\n", beg, end,
1154+
name);
11561155
return false;
11571156
}
11581157
}
@@ -1173,7 +1172,7 @@ static bool InitShadow(bool init_origins, bool dry_run) {
11731172
if (!MEM_IS_APP(&__dfsan::dfsan_init)) {
11741173
if (!dry_run)
11751174
Printf("FATAL: Code %p is out of application range. Non-PIE build?\n",
1176-
(void*)&__dfsan::dfsan_init);
1175+
(uptr)&__dfsan::dfsan_init);
11771176
return false;
11781177
}
11791178

compiler-rt/lib/fuzzer/FuzzerCorpus.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,7 @@ class InputCorpus {
336336
void PrintFeatureSet() {
337337
for (size_t i = 0; i < kFeatureSetSize; i++) {
338338
if(size_t Sz = GetFeature(i))
339-
Printf("[%zd: id %zd sz%zd] ", i, (size_t)SmallestElementPerFeature[i],
340-
Sz);
339+
Printf("[%zd: id %zd sz%zd] ", i, SmallestElementPerFeature[i], Sz);
341340
}
342341
Printf("\n\t");
343342
for (size_t i = 0; i < Inputs.size(); i++)

compiler-rt/lib/fuzzer/FuzzerDriver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,13 @@ static bool ParseOneFlag(const char *Param) {
163163
auto Val = MyStol(Str);
164164
*FlagDescriptions[F].IntFlag = static_cast<int>(Val);
165165
if (Flags.verbosity >= 2)
166-
Printf("Flag: %s %d\n", Name, (int)Val);
166+
Printf("Flag: %s %d\n", Name, Val);
167167
return true;
168168
} else if (FlagDescriptions[F].UIntFlag) {
169169
auto Val = std::stoul(Str);
170170
*FlagDescriptions[F].UIntFlag = static_cast<unsigned int>(Val);
171171
if (Flags.verbosity >= 2)
172-
Printf("Flag: %s %u\n", Name, (uint)Val);
172+
Printf("Flag: %s %u\n", Name, Val);
173173
return true;
174174
} else if (FlagDescriptions[F].StrFlag) {
175175
*FlagDescriptions[F].StrFlag = Str;

compiler-rt/lib/fuzzer/FuzzerLoop.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ void FreeHook(const volatile void *ptr) {
125125
void Fuzzer::HandleMalloc(size_t Size) {
126126
if (!Options.MallocLimitMb || (Size >> 20) < (size_t)Options.MallocLimitMb)
127127
return;
128-
Printf("==%d== ERROR: libFuzzer: out-of-memory (malloc(%zd))\n",
129-
(int)GetPid(), Size);
128+
Printf("==%d== ERROR: libFuzzer: out-of-memory (malloc(%zd))\n", GetPid(),
129+
Size);
130130
Printf(" To change the out-of-memory limit use -rss_limit_mb=<N>\n\n");
131131
PrintStackTrace();
132132
DumpCurrentUnit("oom-");
@@ -568,7 +568,7 @@ size_t Fuzzer::GetCurrentUnitInFuzzingThead(const uint8_t **Data) const {
568568

569569
void Fuzzer::CrashOnOverwrittenData() {
570570
Printf("==%d== ERROR: libFuzzer: fuzz target overwrites its const input\n",
571-
(int)GetPid());
571+
GetPid());
572572
PrintStackTrace();
573573
Printf("SUMMARY: libFuzzer: overwrites-const-input\n");
574574
DumpCurrentUnit("crash-");

compiler-rt/lib/hwasan/hwasan_report.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -738,9 +738,9 @@ void BaseReport::PrintHeapOrGlobalCandidate() const {
738738
Printf("%s", d.Default());
739739
Printf("%s", d.Location());
740740
Printf("%p is located %zd bytes %s a %zd-byte region [%p,%p)\n",
741-
(void*)untagged_addr, offset, whence,
741+
untagged_addr, offset, whence,
742742
candidate.heap.end - candidate.heap.begin,
743-
(void*)candidate.heap.begin, (void*)candidate.heap.end);
743+
(void *)candidate.heap.begin, (void *)candidate.heap.end);
744744
Printf("%s", d.Allocation());
745745
Printf("allocated by thread T%u here:\n", candidate.heap.thread_id);
746746
Printf("%s", d.Default());
@@ -775,14 +775,14 @@ void BaseReport::PrintHeapOrGlobalCandidate() const {
775775
Printf(
776776
"%p is located %s a global variable in "
777777
"\n #0 0x%x (%s+0x%x)\n",
778-
(void*)untagged_addr, candidate.after ? "after" : "before",
779-
(u32)candidate.untagged_addr, module_name, (u32)module_address);
778+
(void *)untagged_addr, candidate.after ? "after" : "before",
779+
(void *)candidate.untagged_addr, module_name, (u32)module_address);
780780
else
781781
Printf(
782782
"%p is located %s a %zd-byte global variable in "
783783
"\n #0 0x%x (%s+0x%x)\n",
784-
(void*)untagged_addr, candidate.after ? "after" : "before", size,
785-
(u32)candidate.untagged_addr, module_name, (u32)module_address);
784+
(void *)untagged_addr, candidate.after ? "after" : "before", size,
785+
(void *)candidate.untagged_addr, module_name, (u32)module_address);
786786
}
787787
Printf("%s", d.Default());
788788
}
@@ -843,9 +843,9 @@ void BaseReport::PrintAddressDescription() const {
843843
Printf("\nCause: use-after-free\n");
844844
Printf("%s", d.Location());
845845
Printf("%p is located %zd bytes inside a %zd-byte region [%p,%p)\n",
846-
(void*)untagged_addr, untagged_addr - UntagAddr(har.tagged_addr),
847-
(ssize)har.requested_size, (void*)UntagAddr(har.tagged_addr),
848-
(void*)(UntagAddr(har.tagged_addr) + har.requested_size));
846+
(void *)untagged_addr, untagged_addr - UntagAddr(har.tagged_addr),
847+
(ssize)har.requested_size, UntagAddr(har.tagged_addr),
848+
(void *)(UntagAddr(har.tagged_addr) + har.requested_size));
849849
Printf("%s", d.Allocation());
850850
Printf("freed by thread T%u here:\n", ha.free_thread_id);
851851
Printf("%s", d.Default());

0 commit comments

Comments
 (0)