[Libvirt-cim] [PATCH 12/19] Coverity: Resolve NO_EFFECT - _set_fv_prop()

John Ferlan jferlan at redhat.com
Thu May 16 14:57:47 UTC 2013


55              bl_ct = dominfo->os_info.fv.bootlist_ct;

(1) Event unsigned_compare:
    This less-than-zero comparison of an unsigned value is never
    true. "bl_ct < 0U".

56              if (bl_ct < 0)
57                      return s;

Resolve by changing the comparison to == rather than <.  Code inspection
determines that bootlist_ct could be zero, but more than likely it's some
other positive value.  It is never negative.
---
 src/Virt_VSSD.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Virt_VSSD.c b/src/Virt_VSSD.c
index 24bf908..7afe2f1 100644
--- a/src/Virt_VSSD.c
+++ b/src/Virt_VSSD.c
@@ -53,7 +53,7 @@ static CMPIStatus _set_fv_prop(const CMPIBroker *broker,
                               (CMPIValue *)&fv, CMPI_boolean);
 
         bl_ct = dominfo->os_info.fv.bootlist_ct;
-        if (bl_ct < 0) 
+        if (bl_ct == 0)
                 return s;
 
         CU_DEBUG("bootlist_ct = %d", bl_ct);
-- 
1.8.1.4




More information about the Libvirt-cim mailing list