[PATCH 0/2] libvirt-qemu: Two simple fixes

*** BLURB HERE *** Michal Prívozník (2): libvirt-qemu: Don't allow NULL cmd in virDomainQemuMonitorCommandWithFiles() libvirt-qemu: Fix capitalization of QEMU src/libvirt-qemu.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) -- 2.34.1

Nothing in daemon code is prepared for the command in virDomainQemuMonitorCommandWithFiles() to be NULL. In fact, the client side doesn't expect this either as our RPC describes the argument as: remote_nonnull_string cmd; Validate the argument in the public API implementation. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/libvirt-qemu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libvirt-qemu.c b/src/libvirt-qemu.c index 9e80577b56..c4f71c0311 100644 --- a/src/libvirt-qemu.c +++ b/src/libvirt-qemu.c @@ -153,6 +153,8 @@ virDomainQemuMonitorCommandWithFiles(virDomainPtr domain, virCheckDomainReturn(domain, -1); conn = domain->conn; + virCheckNonNullArgGoto(cmd, error); + if (ninfiles > 0 || outfiles) { int rc; if ((rc = VIR_DRV_SUPPORTS_FEATURE(conn->driver, conn, -- 2.34.1

In plenty of places we mention qemu, Qemu but the correct form is all capitals. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/libvirt-qemu.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libvirt-qemu.c b/src/libvirt-qemu.c index c4f71c0311..896aba2f0b 100644 --- a/src/libvirt-qemu.c +++ b/src/libvirt-qemu.c @@ -1,5 +1,5 @@ /* - * libvirt-qemu.c: Interfaces for the libvirt library to handle qemu-specific + * libvirt-qemu.c: Interfaces for the libvirt library to handle QEMU-specific * APIs. * * Copyright (C) 2010-2014 Red Hat, Inc. @@ -33,7 +33,7 @@ VIR_LOG_INIT("libvirt-qemu"); /** * virDomainQemuMonitorCommand: * @domain: a domain object - * @cmd: the qemu monitor command string + * @cmd: the QEMU monitor command string * @result: a string returned by @cmd * @flags: bitwise-or of supported virDomainQemuMonitorCommandFlags * @@ -41,14 +41,14 @@ VIR_LOG_INIT("libvirt-qemu"); * connections to the QEMU driver. * * Send an arbitrary monitor command @cmd to @domain through the - * qemu monitor. There are several requirements to safely and + * QEMU monitor. There are several requirements to safely and * successfully use this API: * * - A @cmd that queries state without making any modifications is safe * - A @cmd that alters state that is also tracked by libvirt is unsafe, * and may cause libvirtd to crash * - A @cmd that alters state not tracked by the current version of - * libvirt is possible as a means to test new qemu features before + * libvirt is possible as a means to test new QEMU features before * they have support in libvirt, but no guarantees are made to safety * * If VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP is set, the command is @@ -99,9 +99,9 @@ virDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd, /** * virDomainQemuMonitorCommandWithFiles: * @domain: a domain object - * @cmd: the qemu monitor command string + * @cmd: the QEMU monitor command string * @ninfiles: number of filedescriptors passed in @infiles - * @infiles: filedescriptors to be passed to qemu with the command + * @infiles: filedescriptors to be passed to QEMU with the command * @noutfiles: if non-NULL filled with number of returned file descriptors * @outfiles: if non-NULL filled with an array of returned file descriptors * @result: a string returned by @cmd @@ -111,7 +111,7 @@ virDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd, * connections to the QEMU driver with local connections using the unix socket. * * Send an arbitrary monitor command @cmd with file descriptors @infiles to - * @domain through the qemu monitor and optionally return file descriptors via + * @domain through the QEMU monitor and optionally return file descriptors via * @outfiles. There are several requirements to safely and successfully use * this API: * @@ -119,7 +119,7 @@ virDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd, * - A @cmd that alters state that is also tracked by libvirt is unsafe, * and may cause libvirtd to crash * - A @cmd that alters state not tracked by the current version of - * libvirt is possible as a means to test new qemu features before + * libvirt is possible as a means to test new QEMU features before * they have support in libvirt, but no guarantees are made to safety * * If VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP is set, the command is @@ -321,10 +321,10 @@ virDomainQemuAgentCommand(virDomainPtr domain, * This API is QEMU specific, so it will only work with hypervisor * connections to the QEMU driver. * - * Adds a callback to receive notifications of arbitrary qemu monitor events - * occurring on a domain. Many qemu monitor events also result in a libvirt + * Adds a callback to receive notifications of arbitrary QEMU monitor events + * occurring on a domain. Many QEMU monitor events also result in a libvirt * event which can be delivered via virConnectDomainEventRegisterAny(); this - * command is primarily for testing new qemu events that have not yet been + * command is primarily for testing new QEMU events that have not yet been * given a libvirt counterpart event. * * If @dom is NULL, then events will be monitored for any domain. If @dom -- 2.34.1

On a Tuesday in 2022, Michal Privoznik wrote:
*** BLURB HERE ***
Michal Prívozník (2): libvirt-qemu: Don't allow NULL cmd in virDomainQemuMonitorCommandWithFiles() libvirt-qemu: Fix capitalization of QEMU
src/libvirt-qemu.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Ján Tomko
-
Michal Privoznik