Merge "simpleperf: add inplace-sampler event type."
diff --git a/cpustats/cpustats.c b/cpustats/cpustats.c
index 0042caf..375143b 100644
--- a/cpustats/cpustats.c
+++ b/cpustats/cpustats.c
@@ -105,6 +105,7 @@
}
cpu_count = get_cpu_count();
+ if (cpu_count < 1) die("Unexpected cpu count\n");
old_cpus = malloc(sizeof(struct cpu_info) * cpu_count);
if (!old_cpus) die("Could not allocate struct cpu_info\n");
@@ -112,7 +113,9 @@
if (!new_cpus) die("Could not allocate struct cpu_info\n");
for (i = 0; i < cpu_count; i++) {
- old_cpus[i].freq_count = new_cpus[i].freq_count = get_freq_scales_count(i);
+ freq_count = get_freq_scales_count(i);
+ if (freq_count < 1) die("Unexpected frequency scale count\n");
+ old_cpus[i].freq_count = new_cpus[i].freq_count = freq_count;
new_cpus[i].freqs = malloc(sizeof(struct freq_info) * new_cpus[i].freq_count);
if (!new_cpus[i].freqs) die("Could not allocate struct freq_info\n");
old_cpus[i].freqs = malloc(sizeof(struct freq_info) * old_cpus[i].freq_count);
diff --git a/perfprofd/tests/perfprofd_test.cc b/perfprofd/tests/perfprofd_test.cc
index 679a509..2e9229b 100644
--- a/perfprofd/tests/perfprofd_test.cc
+++ b/perfprofd/tests/perfprofd_test.cc
@@ -202,7 +202,7 @@
{
std::string semaphore(test_dir);
semaphore += "/" SEMAPHORE_FILENAME;
- close(open(semaphore.c_str(), O_WRONLY|O_CREAT));
+ close(open(semaphore.c_str(), O_WRONLY|O_CREAT, 0600));
}
void write_processed_file(int start_seq, int end_seq)