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

Unified Diff: drivers/md/dm-bht.c

Issue 6684008: CHROMIUM: verity: use sg_set_buf instead of sg_set_page (Closed) Base URL: http://git.chromium.org/git/kernel.git@master
Patch Set: Created 9 years, 9 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: drivers/md/dm-bht.c
diff --git a/drivers/md/dm-bht.c b/drivers/md/dm-bht.c
index 4c262a54d0cbd35fca49e0a1c690bccd53628bc6..450bace22dd5ebee80914061262347a87ea32b95 100644
--- a/drivers/md/dm-bht.c
+++ b/drivers/md/dm-bht.c
@@ -95,14 +95,14 @@ typedef int (*dm_bht_compare_cb)(struct dm_bht *, u8 *, u8 *);
/**
* dm_bht_compute_hash: hashes a page of data
*/
-static int dm_bht_compute_hash(struct dm_bht *bht, struct page *page,
+static int dm_bht_compute_hash(struct dm_bht *bht, const void *block,
u8 *digest)
{
struct hash_desc *hash_desc = &bht->hash_desc[smp_processor_id()];
struct scatterlist sg;
sg_init_table(&sg, 1);
- sg_set_page(&sg, page, PAGE_SIZE, 0);
+ sg_set_buf(&sg, block, PAGE_SIZE);
Will Drewry 2011/03/11 19:01:57 I considered using this before but don't we need t
/* Note, this is synchronous. */
if (crypto_hash_init(hash_desc)) {
DMCRIT("failed to reinitialize crypto hash (proc:%d)",
@@ -601,7 +601,7 @@ static int dm_bht_check_block(struct dm_bht *bht, unsigned int block_index,
BUG_ON(atomic_read(&parent->state) < DM_BHT_ENTRY_READY);
node = dm_bht_get_node(bht, parent, depth, block_index);
- if (dm_bht_compute_hash(bht, virt_to_page(block), digest) ||
+ if (dm_bht_compute_hash(bht, block, digest) ||
dm_bht_compare_hash(bht, digest, node)) {
DMERR("failed to verify entry's hash against parent "
"(d=%u,bi=%u)", depth, block_index);
@@ -636,7 +636,7 @@ static int dm_bht_compute_root(struct dm_bht *bht, u8 *digest)
return 1;
}
sg_init_table(&sg, 1);
- sg_set_page(&sg, virt_to_page(entry->nodes), PAGE_SIZE, 0);
+ sg_set_buf(&sg, entry->nodes, PAGE_SIZE);
Will Drewry 2011/03/11 19:01:57 This one is known safe since we use a page pool :)
if (crypto_hash_update(hash_desc, &sg, PAGE_SIZE)) {
DMCRIT("Failed to update crypto hash");
return -EINVAL;
@@ -686,7 +686,6 @@ static int dm_bht_verify_path(struct dm_bht *bht, unsigned int block_index)
while (depth > 0) {
u8 digest[DM_BHT_MAX_DIGEST_SIZE];
struct dm_bht_entry *parent;
- struct page *page;
u8 *node;
int state;
@@ -718,9 +717,8 @@ static int dm_bht_verify_path(struct dm_bht *bht, unsigned int block_index)
*/
BUG_ON(atomic_read(&parent->state) < DM_BHT_ENTRY_READY);
node = dm_bht_get_node(bht, parent, depth, block_index);
- page = virt_to_page(entry->nodes);
- if (dm_bht_compute_hash(bht, page, digest) ||
+ if (dm_bht_compute_hash(bht, entry->nodes, digest) ||
dm_bht_compare_hash(bht, digest, node)) {
DMERR("failed to verify entry's hash against parent "
"(d=%u,bi=%u)", depth, block_index);
@@ -817,7 +815,7 @@ int dm_bht_store_block(struct dm_bht *bht, unsigned int block_index,
return 1;
}
- dm_bht_compute_hash(bht, virt_to_page(block_data),
+ dm_bht_compute_hash(bht, block_data,
dm_bht_node(bht, entry, node_index));
return 0;
}
@@ -883,10 +881,10 @@ int dm_bht_compute(struct dm_bht *bht, void *read_cb_ctx)
for (i = 0; i < level->count; i++, entry++) {
for (j = 0; j < count; j++, child++) {
- struct page *pg = virt_to_page(child->nodes);
- u8 *node = dm_bht_node(bht, entry, j);
+ u8 *block = child->nodes;
+ u8 *digest = dm_bht_node(bht, entry, j);
- r = dm_bht_compute_hash(bht, pg, node);
+ r = dm_bht_compute_hash(bht, block, digest);
if (r) {
DMERR("Failed to update (d=%u,i=%u)",
depth, i);
« 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