From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eb8Ap-0000yY-BO for qemu-devel@nongnu.org; Mon, 15 Jan 2018 12:03:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eb8Am-0006v1-4Q for qemu-devel@nongnu.org; Mon, 15 Jan 2018 12:03:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46388) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eb8Al-0006uA-U7 for qemu-devel@nongnu.org; Mon, 15 Jan 2018 12:03:48 -0500 From: "Daniel P. Berrange" Date: Mon, 15 Jan 2018 17:02:38 +0000 Message-Id: <20180115170243.24578-9-berrange@redhat.com> In-Reply-To: <20180115170243.24578-1-berrange@redhat.com> References: <20180115170243.24578-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v4 08/13] scripts: ensure signrom treats data as bytes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Fam Zheng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Markus Armbruster , Eduardo Habkost , Paolo Bonzini , "Daniel P. Berrange" Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Daniel P. Berrange --- scripts/signrom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/signrom.py b/scripts/signrom.py index d1dabe0240..0497a1c32e 100644 --- a/scripts/signrom.py +++ b/scripts/signrom.py @@ -18,7 +18,7 @@ fin =3D open(sys.argv[1], 'rb') fout =3D open(sys.argv[2], 'wb') =20 magic =3D fin.read(2) -if magic !=3D '\x55\xaa': +if magic !=3D b'\x55\xaa': sys.exit("%s: option ROM does not begin with magic 55 aa" % sys.argv= [1]) =20 size_byte =3D ord(fin.read(1)) @@ -33,7 +33,7 @@ elif len(data) < size: # Add padding if necessary, rounding the whole input to a multiple o= f # 512 bytes according to the third byte of the input. # size-1 because a final byte is added below to store the checksum. - data =3D data.ljust(size-1, '\0') + data =3D data.ljust(size-1, b'\0') else: if ord(data[-1:]) !=3D 0: sys.stderr.write('WARNING: ROM includes nonzero checksum\n') --=20 2.14.3