Message ID | 20230203101430.901476-1-tzungbi@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp756732wrn; Fri, 3 Feb 2023 02:20:49 -0800 (PST) X-Google-Smtp-Source: AK7set8t9oTzt6FGc4+woMb0NmqQfGN1fLRinfLEje+2pX1u/qdgIsWvJQ8OZ+7DdBmZxnuOZgMh X-Received: by 2002:a05:6a20:5488:b0:bd:17a4:c35f with SMTP id i8-20020a056a20548800b000bd17a4c35fmr12893641pzk.23.1675419649437; Fri, 03 Feb 2023 02:20:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675419649; cv=none; d=google.com; s=arc-20160816; b=jAR20wQZazmtjHNQVnnjdehlnrWcqzX1v70ewt2ATE50l+U4NjXJkyP+DyZVnx+TOf DxDRIGQd80Zzx9AvCx1m6YZN6s9Iy3L904Kj3B5Kw+9I43pCotS21J9/bTLmlsyLCHsh 8dhKnmCbHrOedYlIjWg6xZfh3bXmxL92DSDWI2vfafM1XdM6w+9M1+UBuFpAGtA0DJ7J RbalEH2z7YHJAbb8dfyBzcpN23fScgoRwhPtkq76v3wK+SRwHp6VQKt/deVWSl9Arkb5 6ynpzN1+rJZFa/e0XKEHpesLwquoTxqbZqfDZGT27gmD47B1sR08PvV1OZeDJX6bEB/a mHYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=zuaSqQerU0F3xoGjz2Cju8zoJk0RG+cU7WLKzVa+35M=; b=bK62hzv+Vb3flkoArwCU7gF4BR2TLo28A4CdLzQAX7XQaXL759dery69r0X3r28SNl wGSbxU9YqAShrbK0YgJSj548/GBDhwZ1FUrOVwm6ooUu1RBM7HtCTO5xo/gLD1tyS5Kz n0oRX8HXrWrD8rq9jr0mqvMIQiO126jMrMkSKxYsliez8LNUiBPHsl4ArQpUz11XVj2P RRso109ofzQW0BICbvm0ErUeyubxxeEMKMamAZuQ+aTh/u6uzURFXY/X9M0zuchHedKy LEkAYqz4KBiSiWamb9mAmGYfv4QbWBrtUUKIuzG/Q0q3F0Re95N1JK/NdXJLGVjPtVvB myVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CUnz2ksi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p13-20020a63740d000000b004f211eeac10si2768651pgc.164.2023.02.03.02.20.34; Fri, 03 Feb 2023 02:20:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CUnz2ksi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232917AbjBCKOs (ORCPT <rfc822;il.mystafa@gmail.com> + 99 others); Fri, 3 Feb 2023 05:14:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231430AbjBCKOq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 3 Feb 2023 05:14:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9308D8E68D; Fri, 3 Feb 2023 02:14:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 420C3B82A61; Fri, 3 Feb 2023 10:14:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EC8CC4339B; Fri, 3 Feb 2023 10:14:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675419283; bh=vZ/rYih25oqku/POs78MXevzm4PkkNatFdf6w+fBPBk=; h=From:To:Cc:Subject:Date:From; b=CUnz2ksi7YBASBAbOUYKRR6lFhwPwMszS4bJS5QBLyLuRNL8Ki9THh7e+Ox7LAhA0 xEXrZIUcJHxcLpFc8oiZLAO0ur7u8IITfvZBvf8Lmkwbv+sdKV8jNGYSz4/+pGDr4H TGwFqruc7RmovJftPC8+sAKxO3/mkvQSUBNDTqe2sHUVnjyYCTxyuTfu6nzjaCocix VgwWNJc0DWc0TwQWTPi3g0vksBJYkG3ew76FBWDztJTFmmxnb46rjxPT25R/3R91uY iqga8wN3XkNqA8qb/rO/9aK4eueLyE+oHoGuQzFxLRJgltDKAOlG5bzcoJo24uhjmS aFV6rUAYZjRug== From: Tzung-Bi Shih <tzungbi@kernel.org> To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, jarkko@kernel.org, linux-kernel@vger.kernel.org, tzungbi@kernel.org Subject: [PATCH] selftests: tpm2: remove redundant ord() Date: Fri, 3 Feb 2023 18:14:30 +0800 Message-Id: <20230203101430.901476-1-tzungbi@kernel.org> X-Mailer: git-send-email 2.39.1.519.gcb327c4b5f-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756804834348492167?= X-GMAIL-MSGID: =?utf-8?q?1756804834348492167?= |
Series |
selftests: tpm2: remove redundant ord()
|
|
Commit Message
Tzung-Bi Shih
Feb. 3, 2023, 10:14 a.m. UTC
When testing with FLAG_DEBUG enabled client, it emits the following
error messages:
File "/root/tpm2/tpm2.py", line 347, in hex_dump
d = [format(ord(x), '02x') for x in d]
File "/root/tpm2/tpm2.py", line 347, in <listcomp>
d = [format(ord(x), '02x') for x in d]
TypeError: ord() expected string of length 1, but int found
The input of hex_dump() should be packed binary data. Remove the
ord().
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
tools/testing/selftests/tpm2/tpm2.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 2/3/23 03:14, Tzung-Bi Shih wrote: > When testing with FLAG_DEBUG enabled client, it emits the following > error messages: > > File "/root/tpm2/tpm2.py", line 347, in hex_dump > d = [format(ord(x), '02x') for x in d] > File "/root/tpm2/tpm2.py", line 347, in <listcomp> > d = [format(ord(x), '02x') for x in d] > TypeError: ord() expected string of length 1, but int found > > The input of hex_dump() should be packed binary data. Remove the > ord(). > > Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> > --- > tools/testing/selftests/tpm2/tpm2.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/tpm2/tpm2.py b/tools/testing/selftests/tpm2/tpm2.py > index c7363c6764fc..bba8cb54548e 100644 > --- a/tools/testing/selftests/tpm2/tpm2.py > +++ b/tools/testing/selftests/tpm2/tpm2.py > @@ -344,7 +344,7 @@ def get_algorithm(name): > > > def hex_dump(d): > - d = [format(ord(x), '02x') for x in d] > + d = [format(x, '02x') for x in d] > d = [d[i: i + 16] for i in range(0, len(d), 16)] > d = [' '.join(x) for x in d] > d = os.linesep.join(d) Thank you for the patch. It will appear shortly in linux-kselftest next for Linux 6.3-rc1 thanks, -- Shuah
On Fri, Feb 03, 2023 at 06:14:30PM +0800, Tzung-Bi Shih wrote: > When testing with FLAG_DEBUG enabled client, it emits the following > error messages: > > File "/root/tpm2/tpm2.py", line 347, in hex_dump > d = [format(ord(x), '02x') for x in d] > File "/root/tpm2/tpm2.py", line 347, in <listcomp> > d = [format(ord(x), '02x') for x in d] > TypeError: ord() expected string of length 1, but int found > > The input of hex_dump() should be packed binary data. Remove the > ord(). > > Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> > --- > tools/testing/selftests/tpm2/tpm2.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/tpm2/tpm2.py b/tools/testing/selftests/tpm2/tpm2.py > index c7363c6764fc..bba8cb54548e 100644 > --- a/tools/testing/selftests/tpm2/tpm2.py > +++ b/tools/testing/selftests/tpm2/tpm2.py > @@ -344,7 +344,7 @@ def get_algorithm(name): > > > def hex_dump(d): > - d = [format(ord(x), '02x') for x in d] > + d = [format(x, '02x') for x in d] > d = [d[i: i + 16] for i in range(0, len(d), 16)] > d = [' '.join(x) for x in d] > d = os.linesep.join(d) > -- > 2.39.1.519.gcb327c4b5f-goog > Acked-by: Jarkko Sakkinen <jarkko@kernel.org> BR, Jarkko
diff --git a/tools/testing/selftests/tpm2/tpm2.py b/tools/testing/selftests/tpm2/tpm2.py index c7363c6764fc..bba8cb54548e 100644 --- a/tools/testing/selftests/tpm2/tpm2.py +++ b/tools/testing/selftests/tpm2/tpm2.py @@ -344,7 +344,7 @@ def get_algorithm(name): def hex_dump(d): - d = [format(ord(x), '02x') for x in d] + d = [format(x, '02x') for x in d] d = [d[i: i + 16] for i in range(0, len(d), 16)] d = [' '.join(x) for x in d] d = os.linesep.join(d)