From: Lennart Poettering Date: Tue, 3 Jun 2025 14:11:57 +0000 (+0200) Subject: tpm2-util: guarantee that verb_has_tpm2_generic() returns usable exit status X-Git-Tag: v258-rc1~408^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F37690%2Fhead;p=thirdparty%2Fsystemd.git tpm2-util: guarantee that verb_has_tpm2_generic() returns usable exit status --- 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