summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2021-08-16 15:23:48 -0700
committerChristopher Ferris <cferris@google.com>2021-08-17 10:32:05 -0700
commitc2e59964f5866acb106d217462c1771afdd24844 (patch)
treedb663fbe7af03e27872c6803af21c8f4563616be
parent5b9868d9e6830e9205ab69e5bbcac6a6038b2b79 (diff)
downloadplatform_external_scudo-c2e59964f5866acb106d217462c1771afdd24844.tar.gz
platform_external_scudo-c2e59964f5866acb106d217462c1771afdd24844.tar.bz2
platform_external_scudo-c2e59964f5866acb106d217462c1771afdd24844.zip
[scudo] Fix format string specifiersHEADandroid-s-beta-5masterandroid-s-beta-5
Enable `-Wformat` again, and fix the offending instances. Differential Revision: https://reviews.llvm.org/D108168 GitOrigin-RevId: 5009be2f09ae25654753ee533dbfbc238aaf591c Change-Id: Icd55c53967be36c9df0350a17b21decf295e0223
-rw-r--r--standalone/primary64.h4
-rw-r--r--standalone/secondary.h11
-rw-r--r--standalone/size_class_map.h4
-rw-r--r--standalone/wrappers_c.inc2
4 files changed, 10 insertions, 11 deletions
diff --git a/standalone/primary64.h b/standalone/primary64.h
index 13420bf3d22..6c1785512c6 100644
--- a/standalone/primary64.h
+++ b/standalone/primary64.h
@@ -164,9 +164,9 @@ public:
PoppedBlocks += Region->Stats.PoppedBlocks;
PushedBlocks += Region->Stats.PushedBlocks;
}
- Str->append("Stats: SizeClassAllocator64: %zuM mapped (%zuM rss) in %zu "
+ Str->append("Stats: SizeClassAllocator64: %zuM mapped (%uM rss) in %zu "
"allocations; remains %zu\n",
- TotalMapped >> 20, 0, PoppedBlocks,
+ TotalMapped >> 20, 0U, PoppedBlocks,
PoppedBlocks - PushedBlocks);
for (uptr I = 0; I < NumClasses; I++)
diff --git a/standalone/secondary.h b/standalone/secondary.h
index aa50fa98b11..abb58a2882a 100644
--- a/standalone/secondary.h
+++ b/standalone/secondary.h
@@ -602,12 +602,11 @@ void MapAllocator<Config>::deallocate(Options Options, void *Ptr) {
template <typename Config>
void MapAllocator<Config>::getStats(ScopedString *Str) const {
- Str->append(
- "Stats: MapAllocator: allocated %zu times (%zuK), freed %zu times "
- "(%zuK), remains %zu (%zuK) max %zuM\n",
- NumberOfAllocs, AllocatedBytes >> 10, NumberOfFrees, FreedBytes >> 10,
- NumberOfAllocs - NumberOfFrees, (AllocatedBytes - FreedBytes) >> 10,
- LargestSize >> 20);
+ Str->append("Stats: MapAllocator: allocated %u times (%zuK), freed %u times "
+ "(%zuK), remains %u (%zuK) max %zuM\n",
+ NumberOfAllocs, AllocatedBytes >> 10, NumberOfFrees,
+ FreedBytes >> 10, NumberOfAllocs - NumberOfFrees,
+ (AllocatedBytes - FreedBytes) >> 10, LargestSize >> 20);
}
} // namespace scudo
diff --git a/standalone/size_class_map.h b/standalone/size_class_map.h
index ba0f78453bc..28b16d976e5 100644
--- a/standalone/size_class_map.h
+++ b/standalone/size_class_map.h
@@ -335,8 +335,8 @@ template <typename SCMap> inline void printMap() {
const uptr L = S ? getMostSignificantSetBitIndex(S) : 0;
const uptr Cached = SCMap::getMaxCachedHint(S) * S;
Buffer.append(
- "C%02zu => S: %zu diff: +%zu %02zu%% L %zu Cached: %zu %zu; id %zu\n",
- I, S, D, P, L, SCMap::getMaxCachedHint(S), Cached,
+ "C%02zu => S: %zu diff: +%zu %02zu%% L %zu Cached: %u %zu; id %zu\n", I,
+ S, D, P, L, SCMap::getMaxCachedHint(S), Cached,
SCMap::getClassIdBySize(S));
TotalCached += Cached;
PrevS = S;
diff --git a/standalone/wrappers_c.inc b/standalone/wrappers_c.inc
index 43efb02cb86..6c6bcb6783a 100644
--- a/standalone/wrappers_c.inc
+++ b/standalone/wrappers_c.inc
@@ -226,7 +226,7 @@ INTERFACE WEAK int SCUDO_PREFIX(malloc_info)(UNUSED int options, FILE *stream) {
fputs("<malloc version=\"scudo-1\">\n", stream);
for (scudo::uptr i = 0; i != max_size; ++i)
if (sizes[i])
- fprintf(stream, "<alloc size=\"%lu\" count=\"%lu\"/>\n", i, sizes[i]);
+ fprintf(stream, "<alloc size=\"%zu\" count=\"%zu\"/>\n", i, sizes[i]);
fputs("</malloc>\n", stream);
SCUDO_PREFIX(free)(sizes);
return 0;