[libvirt PATCHv2 03/16] qemu: agent: remove impossible errors

Ján Tomko jtomko at redhat.com
Wed Oct 7 12:35:24 UTC 2020


For both 'ip_addr_arr' and 'ret_array', we:
1) already checked that they are arrays
2) only iterate up to the array size

Remove the duplicate checks.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma at redhat.com>
---
 src/qemu/qemu_agent.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index fc7b65de2a..51c597f57e 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -2160,13 +2160,6 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
         const char *hwaddr, *ifname_s, *name = NULL;
         virDomainInterfacePtr iface = NULL;
 
-        /* Shouldn't happen but doesn't hurt to check neither */
-        if (!tmp_iface) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("qemu agent reply missing interface entry in array"));
-            goto error;
-        }
-
         /* interface name is required to be presented */
         name = virJSONValueObjectGetString(tmp_iface, "name");
         if (!name) {
@@ -2229,13 +2222,6 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
 
             ip_addr = &iface->addrs[addrs_count - 1];
 
-            /* Shouldn't happen but doesn't hurt to check neither */
-            if (!ip_addr_obj) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("qemu agent reply missing IP addr in array"));
-                goto error;
-            }
-
             if (qemuAgentGetInterfaceOneAddress(ip_addr, ip_addr_obj, name) < 0)
                 goto error;
         }
-- 
2.26.2




More information about the libvir-list mailing list