[PATCH 3/9] nodeinfo: Add coverity[dead_error_begin] and [returned_null] tags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The use of switch statements inside a bounded for loop resulted in some
false positives regarding the "default:" label which cannot be reached
since each of the other case statements use the possible for loop values.
A [dead_error_begin] was added before the default label.

Commit id ebdbe25a adjusted the algorithm and the caller guarantees that
the 'params' will have a '_' in the name being searched. Add the [returned_null]
tag to the two instances.
---
 src/nodeinfo.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 477104f..a05159c 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -1124,6 +1124,7 @@ nodeSetMemoryParameterValue(virTypedParameterPtr param)
     int ret = -1;
     int rc = -1;
 
+    /* coverity[returned_null] */
     char *field = strchr(param->field, '_');
     field++;
     if (virAsprintf(&path, "%s/%s",
@@ -1161,6 +1162,7 @@ nodeMemoryParametersIsAllSupported(virTypedParameterPtr params,
     for (i = 0; i < nparams; i++) {
         virTypedParameterPtr param = &params[i];
 
+        /* coverity[returned_null] */
         char *field = strchr(param->field, '_');
         field++;
         if (virAsprintf(&path, "%s/%s",
@@ -1413,6 +1415,7 @@ nodeGetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
 
             break;
 
+        /* coverity[dead_error_begin] */
         default:
             break;
         }
-- 
1.7.11.7

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]