aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mpi/mpicoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mpi/mpicoder.c')
-rw-r--r--lib/mpi/mpicoder.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c
index c6272ae2015e..5a0f75a3bf01 100644
--- a/lib/mpi/mpicoder.c
+++ b/lib/mpi/mpicoder.c
@@ -363,6 +363,9 @@ MPI mpi_read_raw_from_sgl(struct scatterlist *sgl, unsigned int nbytes)
363 lzeros = 0; 363 lzeros = 0;
364 } 364 }
365 365
366 miter.consumed = lzeros;
367 sg_miter_stop(&miter);
368
366 nbytes -= lzeros; 369 nbytes -= lzeros;
367 nbits = nbytes * 8; 370 nbits = nbytes * 8;
368 if (nbits > MAX_EXTERN_MPI_BITS) { 371 if (nbits > MAX_EXTERN_MPI_BITS) {
@@ -390,7 +393,10 @@ MPI mpi_read_raw_from_sgl(struct scatterlist *sgl, unsigned int nbytes)
390 z = BYTES_PER_MPI_LIMB - nbytes % BYTES_PER_MPI_LIMB; 393 z = BYTES_PER_MPI_LIMB - nbytes % BYTES_PER_MPI_LIMB;
391 z %= BYTES_PER_MPI_LIMB; 394 z %= BYTES_PER_MPI_LIMB;
392 395
393 for (;;) { 396 while (sg_miter_next(&miter)) {
397 buff = miter.addr;
398 len = miter.length;
399
394 for (x = 0; x < len; x++) { 400 for (x = 0; x < len; x++) {
395 a <<= 8; 401 a <<= 8;
396 a |= *buff++; 402 a |= *buff++;
@@ -400,12 +406,6 @@ MPI mpi_read_raw_from_sgl(struct scatterlist *sgl, unsigned int nbytes)
400 } 406 }
401 } 407 }
402 z += x; 408 z += x;
403
404 if (!sg_miter_next(&miter))
405 break;
406
407 buff = miter.addr;
408 len = miter.length;
409 } 409 }
410 410
411 return val; 411 return val;