diff options
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-crypt.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 0eb5416798bd..ac54f697c508 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -348,16 +348,17 @@ static int crypt_convert(struct crypt_config *cc, | |||
348 | ctx->idx_out < ctx->bio_out->bi_vcnt) { | 348 | ctx->idx_out < ctx->bio_out->bi_vcnt) { |
349 | struct bio_vec *bv_in = bio_iovec_idx(ctx->bio_in, ctx->idx_in); | 349 | struct bio_vec *bv_in = bio_iovec_idx(ctx->bio_in, ctx->idx_in); |
350 | struct bio_vec *bv_out = bio_iovec_idx(ctx->bio_out, ctx->idx_out); | 350 | struct bio_vec *bv_out = bio_iovec_idx(ctx->bio_out, ctx->idx_out); |
351 | struct scatterlist sg_in = { | 351 | struct scatterlist sg_in, sg_out; |
352 | .page = bv_in->bv_page, | 352 | |
353 | .offset = bv_in->bv_offset + ctx->offset_in, | 353 | sg_init_table(&sg_in, 1); |
354 | .length = 1 << SECTOR_SHIFT | 354 | sg_set_page(&sg_in, bv_in->bv_page); |
355 | }; | 355 | sg_in.offset = bv_in->bv_offset + ctx->offset_in; |
356 | struct scatterlist sg_out = { | 356 | sg_in.length = 1 << SECTOR_SHIFT; |
357 | .page = bv_out->bv_page, | 357 | |
358 | .offset = bv_out->bv_offset + ctx->offset_out, | 358 | sg_init_table(&sg_out, 1); |
359 | .length = 1 << SECTOR_SHIFT | 359 | sg_set_page(&sg_out, bv_out->bv_page); |
360 | }; | 360 | sg_out.offset = bv_out->bv_offset + ctx->offset_out; |
361 | sg_out.length = 1 << SECTOR_SHIFT; | ||
361 | 362 | ||
362 | ctx->offset_in += sg_in.length; | 363 | ctx->offset_in += sg_in.length; |
363 | if (ctx->offset_in >= bv_in->bv_len) { | 364 | if (ctx->offset_in >= bv_in->bv_len) { |