On Mon, Feb 11, 2019 at 01:55:17PM -0800, Matthew Garrett wrote: > + if (efi.tpm_final_log != EFI_INVALID_TABLE_ADDR && > + efi_tpm_final_log_size != 0) { > + if (tpm_log_version == EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) { Instead of nesting code heavily I would just: if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR || efi_tpm_final_log_size == 0 || tpm_log_version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) goto out_memunmap; And in the tail: out_munmap: memunmap(final_tbl); memunmap(log_tb); return tpm_log_version; err_munmap: memunmap(final_tbl); memunmap(log_tb); return -ENOMEM; } /Jarkko