Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1304)

Unified Diff: dm-bht.c

Issue 6632013: CHROMIUM: verity: add BUG in check_block for consistency with verify_path (Closed) Base URL: http://git.chromium.org/git/dm-verity.git@master
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm-bht.c
diff --git a/dm-bht.c b/dm-bht.c
index 4ac06fa9d7907f3c2555050389e714df1ab572a7..35713de9bdd0b7f20dc8975443faa4f541087c36 100644
--- a/dm-bht.c
+++ b/dm-bht.c
@@ -606,17 +606,10 @@ static int dm_bht_check_block(struct dm_bht *bht, unsigned int block_index,
index = block_index >> bht->node_count_shift;
entry = &bht->levels[depth].entries[index];
- *entry_state = atomic_read(&entry->state);
- if (*entry_state <= DM_BHT_ENTRY_ERROR) {
- DMCRIT("leaf entry for block %u is invalid",
- block_index);
- return *entry_state;
- }
- if (*entry_state <= DM_BHT_ENTRY_PENDING) {
- DMERR("leaf data not yet loaded for block %u",
- block_index);
- return 1;
- }
+ /* This call is only safe if all nodes along the path
+ * are already populated (i.e. READY) via dm_bht_populate.
+ */
+ BUG_ON(atomic_read(&entry->state) < DM_BHT_ENTRY_READY);
/* Index into the entry data */
index = (block_index % bht->node_count) * bht->digest_size;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698