From 9c335d2458075cec9f9230af64b28c8905fb8362 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 3 Jun 2025 16:11:57 +0200 Subject: [PATCH] tpm2-util: guarantee that verb_has_tpm2_generic() returns usable exit status --- src/shared/tpm2-util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c index e7bc86faa12..1c1ce441a25 100644 --- a/src/shared/tpm2-util.c +++ b/src/shared/tpm2-util.c @@ -7842,6 +7842,8 @@ int verb_has_tpm2_generic(bool quiet) { print_field(" ", "libtss2-mu.so.0", FLAGS_SET(s, TPM2_SUPPORT_LIBTSS2_MU)); } + assert_cc(TPM2_SUPPORT_API <= 255); /* make sure this is safe to use as process exit status */ + /* Return inverted bit flags. So that TPM2_SUPPORT_FULL becomes EXIT_SUCCESS and the other values * become some reasonable values 1…7. i.e. the flags we return here tell what is missing rather than * what is there, acknowledging the fact that for process exit statuses it is customary to return -- 2.47.3