summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-09-03 23:11:28 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-09-03 23:11:28 +0000
commit0621a605cbabc81ec01684d999f7187fd9cf78c5 (patch)
treebeb6a93e2e66fa956aee9ad84f8dcd977d8a69aa
parentda8b85ee05e808d976879fd402cd6dc2ad7c4693 (diff)
parent9988536ecd2d5c3f3cf530bffaf055db11e529e0 (diff)
downloadvold-android11-qpr1-d-release.tar.gz
Change-Id: If759fe839b830e3b1db8e6f963abc0f2d3e6fbae
-rw-r--r--EncryptInplace.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/EncryptInplace.cpp b/EncryptInplace.cpp
index 9d304da9..b1bd11de 100644
--- a/EncryptInplace.cpp
+++ b/EncryptInplace.cpp
@@ -205,9 +205,16 @@ static int encrypt_groups(struct encryptGroupsData* data) {
data->count = 0;
for (block = 0; block < block_count; block++) {
- int used = (aux_info.bg_desc[i].bg_flags & EXT4_BG_BLOCK_UNINIT)
- ? 0
- : bitmap_get_bit(block_bitmap, block);
+ int used;
+
+ if (aux_info.bg_desc[i].bg_flags & EXT4_BG_BLOCK_UNINIT) {
+ // In block groups with an uninitialized block bitmap, we only
+ // need to encrypt the backup superblock (if one is present).
+ used = (ext4_bg_has_super_block(i) && block < 1 + aux_info.bg_desc_blocks);
+ } else {
+ used = bitmap_get_bit(block_bitmap, block);
+ }
+
update_progress(data, used);
if (used) {
if (data->count == 0) {