Skip to content

Commit c3d80af

Browse files
trueptolemybonzini
authored andcommitted
rust/vmstate: Fix num field when varray flags are set
Array type vmstate has the VMStateField with `num` equals its length. When the varray vmstate is built based a array type, the `num` field should be cleaned to 0, because varray uses `num_offset` instead of `num` to store elements number information. Signed-off-by: Zhao Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 6ca5c3b commit c3d80af

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

rust/qemu-api/src/vmstate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ impl VMStateField {
275275
assert!((self.flags.0 & VMStateFlags::VMS_ARRAY.0) != 0);
276276
self.flags = VMStateFlags(self.flags.0 & !VMStateFlags::VMS_ARRAY.0);
277277
self.flags = VMStateFlags(self.flags.0 | flag.0);
278+
self.num = 0; // varray uses num_offset instead of num.
278279
self
279280
}
280281

0 commit comments

Comments
 (0)