summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-10-31 09:09:05 +0100
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-10-31 09:09:05 +0100
commit8ceb0f6698c835e3f33fc36cbfd94d045bdf2722 (patch)
tree6c0c6357cc0f1e8bd6801d49ec5ffb2e12aa9c45
parentSnap for 4422293 from 395b02098ffb93b2ea7611839099180a6db64bfb to pi-release (diff)
parentMerge "update_verifier: Fix the wrong computation with group_range_count." am: 011af6e1a9 am: 78fa902920 (diff)
downloadandroid_bootable_recovery-8ceb0f6698c835e3f33fc36cbfd94d045bdf2722.tar
android_bootable_recovery-8ceb0f6698c835e3f33fc36cbfd94d045bdf2722.tar.gz
android_bootable_recovery-8ceb0f6698c835e3f33fc36cbfd94d045bdf2722.tar.bz2
android_bootable_recovery-8ceb0f6698c835e3f33fc36cbfd94d045bdf2722.tar.lz
android_bootable_recovery-8ceb0f6698c835e3f33fc36cbfd94d045bdf2722.tar.xz
android_bootable_recovery-8ceb0f6698c835e3f33fc36cbfd94d045bdf2722.tar.zst
android_bootable_recovery-8ceb0f6698c835e3f33fc36cbfd94d045bdf2722.zip
-rw-r--r--update_verifier/update_verifier.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/update_verifier/update_verifier.cpp b/update_verifier/update_verifier.cpp
index faebbede0..ba7b7aec4 100644
--- a/update_verifier/update_verifier.cpp
+++ b/update_verifier/update_verifier.cpp
@@ -137,11 +137,12 @@ static bool read_blocks(const std::string& partition, const std::string& range_s
LOG(ERROR) << "Error in parsing range string.";
return false;
}
+ range_count /= 2;
std::vector<std::future<bool>> threads;
size_t thread_num = std::thread::hardware_concurrency() ?: 4;
- thread_num = std::min(thread_num, range_count / 2);
- size_t group_range_count = range_count / thread_num;
+ thread_num = std::min(thread_num, range_count);
+ size_t group_range_count = (range_count + thread_num - 1) / thread_num;
for (size_t t = 0; t < thread_num; t++) {
auto thread_func = [t, group_range_count, &dm_block_device, &ranges, &partition]() {
@@ -154,7 +155,8 @@ static bool read_blocks(const std::string& partition, const std::string& range_s
return false;
}
- for (size_t i = 1 + group_range_count * t; i < group_range_count * (t + 1) + 1; i += 2) {
+ for (size_t i = group_range_count * 2 * t + 1;
+ i < std::min(group_range_count * 2 * (t + 1) + 1, ranges.size()); i += 2) {
unsigned int range_start, range_end;
bool parse_status = android::base::ParseUint(ranges[i], &range_start);
parse_status = parse_status && android::base::ParseUint(ranges[i + 1], &range_end);