From: Fabiano Rosas <farosas@linux.ibm.com>
To: qemu-devel@nongnu.org
Cc: eduardo@habkost.net, crosa@redhat.com
Subject: [PATCH] analyze-migration.py: Fix instance_id signedness
Date: Mon, 21 Feb 2022 14:53:57 -0300 [thread overview]
Message-ID: <20220221175357.2103775-1-farosas@linux.ibm.com> (raw)
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
next reply other threads:[~2022-02-21 17:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-21 17:53 Fabiano Rosas [this message]
2022-02-21 18:47 ` [PATCH] analyze-migration.py: Fix instance_id signedness Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220221175357.2103775-1-farosas@linux.ibm.com \
--to=farosas@linux.ibm.com \
--cc=crosa@redhat.com \
--cc=eduardo@habkost.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).