[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e18b57e3-f8f4-5c4c-c750-7ae53c5ae1e8@linuxfoundation.org>
Date: Fri, 3 Feb 2023 09:27:41 -0700
From: Shuah Khan <skhan@...uxfoundation.org>
To: Tzung-Bi Shih <tzungbi@...nel.org>, shuah@...nel.org
Cc: linux-kselftest@...r.kernel.org, jarkko@...nel.org,
linux-kernel@...r.kernel.org,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] selftests: tpm2: remove redundant ord()
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@...nel.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
Powered by blists - more mailing lists