Hi,
Please find the latest report on new defect(s) introduced to libvirt found with Coverity
Scan.
9 new defect(s) introduced to libvirt found with Coverity Scan.
4 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build
analyzed by Coverity Scan.
New defect(s) Reported-by: Coverity Scan
Showing 9 of 9 defect(s)
** CID 403562: Null pointer dereferences (NULL_RETURNS)
________________________________________________________________________________________________________
*** CID 403562: Null pointer dereferences (NULL_RETURNS)
/src/qemu/qemu_monitor_json.c: 3587 in qemuMonitorJSONQueryRxFilterParse()
3581
3582 if (!fil)
3583 return -1;
3584
3585 returnArray = virJSONValueObjectGetArray(msg, "return");
3586
>> CID 403562: Null pointer dereferences (NULL_RETURNS)
>> Dereferencing a pointer that might be "NULL"
"returnArray" when calling "virJSONValueArrayGet".
3587
if (!(entry = virJSONValueArrayGet(returnArray, 0))) {
3588 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
3589 _("query-rx-filter return data missing array
element"));
3590 return -1;
3591 }
3592
** CID 403561: Null pointer dereferences (NULL_RETURNS)
________________________________________________________________________________________________________
*** CID 403561: Null pointer dereferences (NULL_RETURNS)
/src/qemu/qemu_monitor_json.c: 410 in qemuMonitorJSONGetReply()
404 virJSONValue *data;
405
406 if (qemuMonitorJSONCheckError(cmd, reply) < 0)
407 return NULL;
408
409 data = virJSONValueObjectGet(reply, "return");
>> CID 403561: Null pointer dereferences (NULL_RETURNS)
>> Dereferencing a pointer that might be "NULL" "data" when
calling "virJSONValueGetType".
410 if (virJSONValueGetType(data)
!= type) {
411 g_autofree char *cmdstr = virJSONValueToString(cmd, false);
412 g_autofree char *retstr = virJSONValueToString(data, false);
413
414 VIR_DEBUG("Unexpected return type %d (expecting %d) for command %s:
%s",
415 virJSONValueGetType(data), type, cmdstr, retstr);
** CID 403560: Null pointer dereferences (NULL_RETURNS)
________________________________________________________________________________________________________
*** CID 403560: Null pointer dereferences (NULL_RETURNS)
/src/qemu/qemu_monitor_json.c: 8054 in qemuMonitorJSONExtractPRManagerInfo()
8048 {
8049 virJSONValue *data;
8050 size_t i;
8051
8052 data = virJSONValueObjectGetArray(reply, "return");
8053
>> CID 403560: Null pointer dereferences (NULL_RETURNS)
>> Dereferencing a pointer that might be "NULL" "data" when
calling "virJSONValueArraySize".
8054 for (i = 0; i <
virJSONValueArraySize(data); i++) {
8055 g_autofree qemuMonitorPRManagerInfo *entry = NULL;
8056 virJSONValue *prManager = virJSONValueArrayGet(data, i);
8057 const char *alias;
8058
8059 if (!(alias = virJSONValueObjectGetString(prManager, "id")))
** CID 403559: Null pointer dereferences (NULL_RETURNS)
________________________________________________________________________________________________________
*** CID 403559: Null pointer dereferences (NULL_RETURNS)
/src/qemu/qemu_monitor_json.c: 3783 in qemuMonitorJSONExtractChardevInfo()
3777 int ret = -1;
3778 size_t i;
3779 qemuMonitorChardevInfo *entry = NULL;
3780
3781 data = virJSONValueObjectGetArray(reply, "return");
3782
>> CID 403559: Null pointer dereferences (NULL_RETURNS)
>> Dereferencing a pointer that might be "NULL" "data" when
calling "virJSONValueArraySize".
3783 for (i = 0; i <
virJSONValueArraySize(data); i++) {
3784 virJSONValue *chardev = virJSONValueArrayGet(data, i);
3785 const char *type;
3786 const char *alias;
3787 bool connected;
3788
** CID 403558: Null pointer dereferences (NULL_RETURNS)
________________________________________________________________________________________________________
*** CID 403558: Null pointer dereferences (NULL_RETURNS)
/src/qemu/qemu_monitor_json.c: 3391 in qemuMonitorJSONQueryFdsetsParse()
3385 size_t i;
3386 g_autoptr(qemuMonitorFdsets) sets = g_new0(qemuMonitorFdsets, 1);
3387 int ninfo;
3388
3389 returnArray = virJSONValueObjectGetArray(msg, "return");
3390
>> CID 403558: Null pointer dereferences (NULL_RETURNS)
>> Dereferencing a pointer that might be "NULL"
"returnArray" when calling "virJSONValueArraySize".
3391
ninfo = virJSONValueArraySize(returnArray);
3392 if (ninfo > 0)
3393 sets->fdsets = g_new0(qemuMonitorFdsetInfo, ninfo);
3394 sets->nfdsets = ninfo;
3395
3396 for (i = 0; i < ninfo; i++) {
** CID 403557: Null pointer dereferences (NULL_RETURNS)
________________________________________________________________________________________________________
*** CID 403557: Null pointer dereferences (NULL_RETURNS)
/src/qemu/qemu_monitor_json.c: 5969 in qemuMonitorJSONGetSEVCapabilities()
5963
5964 if (qemuMonitorJSONCheckError(cmd, reply) < 0)
5965 return -1;
5966
5967 caps = virJSONValueObjectGetObject(reply, "return");
5968
>> CID 403557: Null pointer dereferences (NULL_RETURNS)
>> Dereferencing a pointer that might be "NULL" "caps" when
calling "virJSONValueObjectGetNumberUint".
5969 if
(virJSONValueObjectGetNumberUint(caps, "cbitpos", &cbitpos) < 0) {
5970 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
5971 _("query-sev-capabilities reply was missing"
5972 " 'cbitpos' field"));
5973 return -1;
5974 }
** CID 403556: Null pointer dereferences (NULL_RETURNS)
________________________________________________________________________________________________________
*** CID 403556: Null pointer dereferences (NULL_RETURNS)
/src/qemu/qemu_monitor_json.c: 2895 in qemuMonitorJSONGetMigrationStatsReply()
2889 int rc;
2890 double mbps;
2891 const char *tmp;
2892
2893 ret = virJSONValueObjectGetObject(reply, "return");
2894
>> CID 403556: Null pointer dereferences (NULL_RETURNS)
>> Dereferencing a pointer that might be "NULL" "ret" when
calling "virJSONValueObjectGetString".
2895 if (!(statusstr =
virJSONValueObjectGetString(ret, "status"))) {
2896 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
2897 _("info migration reply was missing return
status"));
2898 return -1;
2899 }
2900
** CID 403555: Null pointer dereferences (NULL_RETURNS)
________________________________________________________________________________________________________
*** CID 403555: Null pointer dereferences (NULL_RETURNS)
/src/qemu/qemu_monitor_json.c: 8696 in qemuMonitorJSONExtractQueryStatsSchema()
8690
8691 if (!virJSONValueIsObject(obj))
8692 continue;
8693
8694 stats = virJSONValueObjectGetArray(obj, "stats");
8695
>> CID 403555: Null pointer dereferences (NULL_RETURNS)
>> Dereferencing a pointer that might be "NULL" "stats" when
calling "virJSONValueIsArray".
8696 if
(!virJSONValueIsArray(stats))
8697 continue;
8698
8699 target_str = virJSONValueObjectGetString(obj, "target");
8700 target = qemuMonitorQueryStatsTargetTypeFromString(target_str);
8701
** CID 403554: Null pointer dereferences (NULL_RETURNS)
________________________________________________________________________________________________________
*** CID 403554: Null pointer dereferences (NULL_RETURNS)
/src/qemu/qemu_monitor_json.c: 6061 in qemuMonitorJSONGetSGXCapabilities()
6055
6056 if (qemuMonitorJSONCheckError(cmd, reply) < 0)
6057 return -1;
6058
6059 caps = virJSONValueObjectGetObject(reply, "return");
6060
>> CID 403554: Null pointer dereferences (NULL_RETURNS)
>> Dereferencing a pointer that might be "NULL" "caps" when
calling "virJSONValueObjectGetBoolean".
6061 if
(virJSONValueObjectGetBoolean(caps, "flc", &capability->flc) < 0) {
6062 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
6063 _("query-sgx-capabilities reply was missing
'flc' field"));
6064 return -1;
6065 }
6066
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit,
https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my...