* [PATCH] selftests: tpm2: remove redundant ord()
@ 2023-02-03 10:14 Tzung-Bi Shih
2023-02-03 16:27 ` Shuah Khan
2023-02-08 2:50 ` Jarkko Sakkinen
0 siblings, 2 replies; 3+ messages in thread
From: Tzung-Bi Shih @ 2023-02-03 10:14 UTC (permalink / raw)
To: shuah; +Cc: linux-kselftest, jarkko, linux-kernel, tzungbi
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] selftests: tpm2: remove redundant ord()
2023-02-03 10:14 [PATCH] selftests: tpm2: remove redundant ord() Tzung-Bi Shih
@ 2023-02-03 16:27 ` Shuah Khan
2023-02-08 2:50 ` Jarkko Sakkinen
1 sibling, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2023-02-03 16:27 UTC (permalink / raw)
To: Tzung-Bi Shih, shuah; +Cc: linux-kselftest, jarkko, linux-kernel, Shuah Khan
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests: tpm2: remove redundant ord()
2023-02-03 10:14 [PATCH] selftests: tpm2: remove redundant ord() Tzung-Bi Shih
2023-02-03 16:27 ` Shuah Khan
@ 2023-02-08 2:50 ` Jarkko Sakkinen
1 sibling, 0 replies; 3+ messages in thread
From: Jarkko Sakkinen @ 2023-02-08 2:50 UTC (permalink / raw)
To: Tzung-Bi Shih; +Cc: shuah, linux-kselftest, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-08 2:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-03 10:14 [PATCH] selftests: tpm2: remove redundant ord() Tzung-Bi Shih
2023-02-03 16:27 ` Shuah Khan
2023-02-08 2:50 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox