aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/scatterlist.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index b7b449dafbe5..a295e404e908 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -347,9 +347,12 @@ bool sg_miter_next(struct sg_mapping_iter *miter)
347 sg_miter_stop(miter); 347 sg_miter_stop(miter);
348 348
349 /* get to the next sg if necessary. __offset is adjusted by stop */ 349 /* get to the next sg if necessary. __offset is adjusted by stop */
350 if (miter->__offset == miter->__sg->length && --miter->__nents) { 350 while (miter->__offset == miter->__sg->length) {
351 miter->__sg = sg_next(miter->__sg); 351 if (--miter->__nents) {
352 miter->__offset = 0; 352 miter->__sg = sg_next(miter->__sg);
353 miter->__offset = 0;
354 } else
355 return false;
353 } 356 }
354 357
355 /* map the next page */ 358 /* map the next page */