* [PATCH] analyze-migration.py: Fix instance_id signedness
@ 2022-02-21 17:53 Fabiano Rosas
2022-02-21 18:47 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 2+ messages in thread
From: Fabiano Rosas @ 2022-02-21 17:53 UTC (permalink / raw)
To: qemu-devel; +Cc: eduardo, crosa
The instance_id field is uint32_t in the migration code, however the
script currently handles it as a signed integer:
$ ./scripts/analyze-migration.py -f mig
Traceback (most recent call last):
File "./scripts/analyze-migration.py", line 605, in <module>
dump.read(dump_memory = args.memory)
File "./scripts/analyze-migration.py", line 539, in read
classdesc = self.section_classes[section_key]
KeyError: ('spapr_iommu', -2147483648)
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
---
scripts/analyze-migration.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
index b82a1b0c58..713f645eea 100755
--- a/scripts/analyze-migration.py
+++ b/scripts/analyze-migration.py
@@ -40,8 +40,8 @@ def __init__(self, filename):
def read64(self):
return int.from_bytes(self.file.read(8), byteorder='big', signed=True)
- def read32(self):
- return int.from_bytes(self.file.read(4), byteorder='big', signed=True)
+ def read32(self, signed=True):
+ return int.from_bytes(self.file.read(4), byteorder='big', signed=signed)
def read16(self):
return int.from_bytes(self.file.read(2), byteorder='big', signed=True)
@@ -533,7 +533,7 @@ def read(self, desc_only = False, dump_memory = False, write_memory = False):
elif section_type == self.QEMU_VM_SECTION_START or section_type == self.QEMU_VM_SECTION_FULL:
section_id = file.read32()
name = file.readstr()
- instance_id = file.read32()
+ instance_id = file.read32(signed=False)
version_id = file.read32()
section_key = (name, instance_id)
classdesc = self.section_classes[section_key]
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] analyze-migration.py: Fix instance_id signedness
2022-02-21 17:53 [PATCH] analyze-migration.py: Fix instance_id signedness Fabiano Rosas
@ 2022-02-21 18:47 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-02-21 18:47 UTC (permalink / raw)
To: Fabiano Rosas, qemu-devel; +Cc: eduardo, crosa
On 21/2/22 18:53, Fabiano Rosas wrote:
> The instance_id field is uint32_t in the migration code, however the
> script currently handles it as a signed integer:
>
> $ ./scripts/analyze-migration.py -f mig
> Traceback (most recent call last):
> File "./scripts/analyze-migration.py", line 605, in <module>
> dump.read(dump_memory = args.memory)
> File "./scripts/analyze-migration.py", line 539, in read
> classdesc = self.section_classes[section_key]
> KeyError: ('spapr_iommu', -2147483648)
>
> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
> ---
> scripts/analyze-migration.py | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-21 18:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-21 17:53 [PATCH] analyze-migration.py: Fix instance_id signedness Fabiano Rosas
2022-02-21 18:47 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).