diff --git a/src/tpm2-setup/tpm2-clear.c b/src/tpm2-setup/tpm2-clear.c index 0dcee96a07..5c4fc2a5de 100644 --- a/src/tpm2-setup/tpm2-clear.c +++ b/src/tpm2-setup/tpm2-clear.c @@ -94,14 +94,15 @@ static int request_tpm2_clear(void) { if (clear < 0) { bool b; - r = proc_cmdline_get_bool("systemd.tpm2_allow_clear", /* flags= */ 0, &b); + r = proc_cmdline_get_bool("systemd.tpm2_allow_clear", PROC_CMDLINE_TRUE_WHEN_MISSING, &b); if (r < 0) return log_error_errno(r, "Failed to parse systemd.tpm2_allow_clear kernel command line argument: %m"); - if (r > 0) - clear = b; + clear = b; } - if (clear == 0) { + assert(clear >= 0); + + if (!clear) { log_info("Clearing TPM2 disabled, exiting early."); return 0; }