[PATCH v2] qemu_tpm: Check for qemuTPMSetupEncryption() errors

Jiri Denemark jdenemar at redhat.com
Tue Nov 29 09:00:59 UTC 2022


On Tue, Nov 22, 2022 at 16:45:58 +0100, Michal Privoznik wrote:
> Inside of qemuTPMEmulatorBuildCommand() there are two calls to
> qemuTPMSetupEncryption() which simply ignore returned error. This
> is suboptimal because then we rely on swtpm binary reporting a
> generic error (something among invalid command line arguments)
> while an error reported by qemuTPMSetupEncryption() is more
> specific.
> 
> However, since virCommandSetSendBuffer() only sets an error
> inside of virCommand structure (the error is then reported in
> virCommandRun()), we need to exempt its retval from error
> checking. Thus, the signature of qemuTPMSetupEncryption() is
> changed a bit so that -1/0 can be returned to indicate error.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> 
> v2 of:
> 
> https://listman.redhat.com/archives/libvir-list/2022-November/235866.html
> 
> diff to v1:
> - Ignore error from virCommandSetSendBuffer() as it'll be reported
>   later. Don't actually jump onto error label as it would defeat the
>   purpose.
> 
>  src/qemu/qemu_tpm.c | 29 ++++++++++++++++++++---------
>  1 file changed, 20 insertions(+), 9 deletions(-)

Reviewed-by: Jiri Denemark <jdenemar at redhat.com>


More information about the libvir-list mailing list