:: commit 97eaf2777d1451611d637d30ef5d67ef75da96f6

mintsuki <mintsuki@protonmail.com> — 2021-12-29 00:18

parents: 63c3f48f49

volume: Catch xfer_size==0 condition in cache_block()

diff --git a/stage23/lib/part.s2.c b/stage23/lib/part.s2.c
index 024c82e0..8e089ac0 100644
--- a/stage23/lib/part.s2.c
+++ b/stage23/lib/part.s2.c
@@ -38,6 +38,9 @@ static bool cache_block(struct volume *volume, uint64_t block) {
                            first_sect + block * volume->fastest_xfer_size,
                            xfer_size)) {
         xfer_size--;
+        if (xfer_size == 0) {
+            return false;
+        }
     }
 
     volume->cache_status = CACHE_READY;
tab: 248 wrap: offon