libxc: add assertion to avoid setting same bit more than once
authorWei Liu <wei.liu2@citrix.com>
Sun, 6 Sep 2015 20:05:39 +0000 (21:05 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 7 Sep 2015 10:54:30 +0000 (11:54 +0100)
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/libxc/xc_sr_restore.c

index 924dd5534d6359d1f74c18d35af857ab3c6838bc..f48e7fcfe02d72ac42f4a315f45e0deae0e89a68 100644 (file)
@@ -181,6 +181,7 @@ static int pfn_set_populated(struct xc_sr_context *ctx, xen_pfn_t pfn)
         ctx->restore.max_populated_pfn = new_max;
     }
 
+    assert(!test_bit(pfn, ctx->restore.populated_pfns));
     set_bit(pfn, ctx->restore.populated_pfns);
 
     return 0;