@samitouri / QOSamiQemu / commits / de49227611

dump/dump.c: reorder usage and assertion of block

Reorder the code so the assertion of block occurs before it is used in the subsequent lines. Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>

Sergei Heifetz committed Feb 8, 2026 at 15:39 UTC de49227611d4ec6b86ffa204220b2c320840055f
1 file changed +1 -1
dump/dump.c
+1 -1
@@ -1288,6 +1288,7 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr,
1288 /* block == NULL means the start of the iteration */
1289 if (!block) {
1290 block = QTAILQ_FIRST(&s->guest_phys_blocks.head);
1291 + assert(block);
1292 *blockptr = block;
1293 addr = block->target_start;
1294 *pfnptr = dump_paddr_to_pfn(s, addr);
@@ -1295,7 +1296,6 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr,
1296 *pfnptr += 1;
1297 addr = dump_pfn_to_paddr(s, *pfnptr);
1298 }
1298 - assert(block != NULL);
1299
1300 while (1) {
1301 if (addr >= block->target_start && addr < block->target_end) {