[libvirt] Coverity automatic detection

Alex Jia ajia at redhat.com
Tue Nov 1 12:13:36 UTC 2011


This email is automatically generated.

The test result is based on the following git commit:
c85013b Fix storage pool source comparison to avoid comparing with self

Analysis summary report:
------------------------
Files analyzed                 : 232
Total LoC input to cov-analyze : 326003
Functions analyzed             : 7884
Paths analyzed                 : 892728
New defects found              : 45 Total
                                  7 ATOMICITY
                                  2 DEADCODE
                                  7 FORWARD_NULL
                                 13 LOCK
                                  2 NEGATIVE_RETURNS
                                  1 NULL_RETURNS
                                  1 RETURN_LOCAL
                                 12 REVERSE_INULL

Exceeded path limit of 5000 paths in 0.13% of functions (normally up to 5% of functions encounter this limitation)

For details, please see attachment.


Regards,
Alex
-------------- next part --------------
Error: ATOMICITY:
/libvirt/src/util/event_poll.c:602:
lock: Locking "eventLoop.lock.lock".
/libvirt/src/util/event_poll.c:609:
def: Assigning: "fds" = data that might be protected by the lock.
/libvirt/src/util/event_poll.c:613:
unlock: Unlocking "eventLoop.lock.lock". "fds" might now be unreliable because other threads can now change the data that it depends on.
/libvirt/src/util/event_poll.c:631:
lockagain: Locking "eventLoop.lock.lock" again.
/libvirt/src/util/event_poll.c:635:
use: Using an unreliable value of "fds" inside the second locked section.  If the data that "fds" depends on was changed by another thread, this use might be incorrect.

Error: ATOMICITY:
/libvirt/src/fdstream.c:146:
lock: Locking "fdst->lock.lock".
/libvirt/src/fdstream.c:153:
def: Assigning: "cbopaque" = data that might be protected by the lock.
/libvirt/src/fdstream.c:156:
unlock: Unlocking "fdst->lock.lock". "cbopaque" might now be unreliable because other threads can now change the data that it depends on.
/libvirt/src/fdstream.c:160:
lockagain: Locking "fdst->lock.lock" again.
/libvirt/src/fdstream.c:163:
use: Using an unreliable value of "cbopaque" inside the second locked section.  If the data that "cbopaque" depends on was changed by another thread, this use might be incorrect.

Error: ATOMICITY:
/libvirt/src/rpc/virnetclientstream.c:385:
lock: Locking "st->lock.lock".
/libvirt/src/rpc/virnetclientstream.c:396:
def: Assigning: "msg" = data that might be protected by the lock.
/libvirt/src/rpc/virnetclientstream.c:409:
unlock: Unlocking "st->lock.lock". "msg" might now be unreliable because other threads can now change the data that it depends on.
/libvirt/src/rpc/virnetclientstream.c:411:
lockagain: Locking "st->lock.lock" again.
/libvirt/src/rpc/virnetclientstream.c:412:
use: Using an unreliable value of "msg" inside the second locked section.  If the data that "msg" depends on was changed by another thread, this use might be incorrect.

Error: ATOMICITY:
/libvirt/src/rpc/virnetclientstream.c:96:
lock: Locking "st->lock.lock".
/libvirt/src/rpc/virnetclientstream.c:109:
def: Assigning: "cbOpaque" = data that might be protected by the lock.
/libvirt/src/rpc/virnetclientstream.c:113:
unlock: Unlocking "st->lock.lock". "cbOpaque" might now be unreliable because other threads can now change the data that it depends on.
/libvirt/src/rpc/virnetclientstream.c:115:
lockagain: Locking "st->lock.lock" again.
/libvirt/src/rpc/virnetclientstream.c:119:
use: Using an unreliable value of "cbOpaque" inside the second locked section.  If the data that "cbOpaque" depends on was changed by another thread, this use might be incorrect.

Error: ATOMICITY:
/libvirt/src/util/threadpool.c:95:
lock: Locking "pool->mutex.lock".
/libvirt/src/util/threadpool.c:129:
def: Assigning: "pool->jobList.firstPrio" = data that might be protected by the lock.
/libvirt/src/util/threadpool.c:143:
unlock: Unlocking "pool->mutex.lock". "pool->jobList.firstPrio" might now be unreliable because other threads can now change the data that it depends on.
/libvirt/src/util/threadpool.c:146:
lockagain: Locking "pool->mutex.lock" again.
/libvirt/src/util/threadpool.c:116:
use: Using an unreliable value of "pool->jobList.firstPrio" inside the second locked section.  If the data that "pool->jobList.firstPrio" depends on was changed by another thread, this use might be incorrect.

Error: ATOMICITY:
/libvirt/src/util/threadpool.c:146:
lock: Locking "pool->mutex.lock".
/libvirt/src/util/threadpool.c:129:
def: Assigning: "pool->jobList.firstPrio" = data that might be protected by the lock.
/libvirt/src/util/threadpool.c:143:
unlock: Unlocking "pool->mutex.lock". "pool->jobList.firstPrio" might now be unreliable because other threads can now change the data that it depends on.
/libvirt/src/util/threadpool.c:146:
lockagain: Locking "pool->mutex.lock" again.
/libvirt/src/util/threadpool.c:116:
use: Using an unreliable value of "pool->jobList.firstPrio" inside the second locked section.  If the data that "pool->jobList.firstPrio" depends on was changed by another thread, this use might be incorrect.

Error: ATOMICITY:
/libvirt/src/util/threadpool.c:146:
lock: Locking "pool->mutex.lock".
/libvirt/src/util/threadpool.c:135:
def: Assigning: "pool->jobList.head" = data that might be protected by the lock.
/libvirt/src/util/threadpool.c:143:
unlock: Unlocking "pool->mutex.lock". "pool->jobList.head" might now be unreliable because other threads can now change the data that it depends on.
/libvirt/src/util/threadpool.c:146:
lockagain: Locking "pool->mutex.lock" again.
/libvirt/src/util/threadpool.c:118:
use: Using an unreliable value of "pool->jobList.head" inside the second locked section.  If the data that "pool->jobList.head" depends on was changed by another thread, this use might be incorrect.

Error: DEADCODE:
/libvirt/gnulib/lib/strerror_r.c:155:
dead_error_condition: On this path, the condition "msg" cannot be true.
/libvirt/gnulib/lib/strerror_r.c:153:
const: After this line, the value of "msg" is equal to 0.
/libvirt/gnulib/lib/strerror_r.c:153:
assignment: Assigning: "msg" = "NULL".
/libvirt/gnulib/lib/strerror_r.c:156:
dead_error_line: Execution cannot reach this statement "return safe_copy(buf, bufle...".

Error: DEADCODE:
/libvirt/gnulib/lib/strerror.c:47:
dead_error_condition: On this path, the condition "msg" cannot be true.
/libvirt/gnulib/lib/strerror.c:46:
const: After this line, the value of "msg" is equal to 0.
/libvirt/gnulib/lib/strerror.c:46:
assignment: Assigning: "msg" = "NULL".
/libvirt/gnulib/lib/strerror.c:48:
dead_error_line: Execution cannot reach this statement "return (char *)msg;".

Error: FORWARD_NULL:
/libvirt/src/util/command.c:1593:
var_compare_op: Comparing "cmd->errbuf" to null implies that "cmd->errbuf" might be null.
/libvirt/src/util/command.c:1647:
alias_transfer: Assigning null: "buf" = "cmd->errbuf".
/libvirt/src/util/command.c:1669:
var_deref_model: Passing null variable "buf" to function "virReallocN", which dereferences it. (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)

Error: FORWARD_NULL:
/libvirt/src/util/command.c:1586:
var_compare_op: Comparing "cmd->outbuf" to null implies that "cmd->outbuf" might be null.
/libvirt/src/util/command.c:1644:
alias_transfer: Assigning null: "buf" = "cmd->outbuf".
/libvirt/src/util/command.c:1669:
var_deref_model: Passing null variable "buf" to function "virReallocN", which dereferences it. (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)

Error: FORWARD_NULL:
/libvirt/src/rpc/virnetserver.c:713:
var_compare_op: Comparing "srv->clients" to null implies that "srv->clients" might be null.
/libvirt/src/rpc/virnetserver.c:735:
var_deref_op: Dereferencing null variable "srv->clients".

Error: FORWARD_NULL:
/libvirt/src/nwfilter/nwfilter_ebiptables_driver.c:3341:
var_compare_op: Comparing "inst" to null implies that "inst" might be null.
/libvirt/src/nwfilter/nwfilter_ebiptables_driver.c:3346:
var_deref_op: Dereferencing null variable "inst".

Error: FORWARD_NULL:
/libvirt/src/qemu/qemu_driver.c:6331:
assign_zero: Assigning: "group" = 0.
/libvirt/src/qemu/qemu_driver.c:6458:
var_deref_model: Passing null variable "group" to function "virCgroupGetMemoryHardLimit", which dereferences it.
/libvirt/src/util/cgroup.c:1055:
deref_parm_in_call: Function "virCgroupGetValueU64" dereferences parameter "group".
/libvirt/src/util/cgroup.c:434:
deref_parm_in_call: Function "virCgroupGetValueStr" dereferences parameter "group".
/libvirt/src/util/cgroup.c:343:
deref_parm_in_call: Function "virCgroupPathOfController" dereferences parameter "group".
/libvirt/src/util/cgroup.c:280:
deref_parm: Directly dereferencing parameter "group".

Error: FORWARD_NULL:
/libvirt/src/qemu/qemu_driver.c:3562:
assign_zero: Assigning: "targetDef" = 0.
/libvirt/src/qemu/qemu_driver.c:3631:
var_deref_op: Dereferencing null variable "targetDef".

Error: FORWARD_NULL:
/libvirt/tools/virsh.c:13460:
var_compare_op: Comparing "from" to null implies that "from" might be null.
/libvirt/tools/virsh.c:13461:
var_deref_model: Passing null variable "from" to function "strcmp", which dereferences it. (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)

Error: LOCK:
/libvirt/src/util/event_poll.c:440:
lock: "virMutexLock" locks "eventLoop.lock.lock".
/libvirt/src/util/threads-pthread.c:85:
lock: "pthread_mutex_lock" locks "m->lock".
/libvirt/src/util/event_poll.c:443:
missing_unlock: Returning without unlocking "eventLoop.lock.lock".

Error: LOCK:
/libvirt/src/datatypes.c:275:
lock: "virMutexLock" locks "domain->conn->lock.lock".
/libvirt/src/util/threads-pthread.c:85:
lock: "pthread_mutex_lock" locks "m->lock".
/libvirt/src/datatypes.c:282:
missing_unlock: Returning without unlocking "domain->conn->lock.lock".

Error: LOCK:
/libvirt/src/datatypes.c:1125:
lock: "virMutexLock" locks "st->conn->lock.lock".
/libvirt/src/util/threads-pthread.c:85:
lock: "pthread_mutex_lock" locks "m->lock".
/libvirt/src/datatypes.c:1132:
missing_unlock: Returning without unlocking "st->conn->lock.lock".

Error: LOCK:
/libvirt/src/datatypes.c:144:
lock: "virMutexLock" locks "conn->lock.lock".
/libvirt/src/util/threads-pthread.c:85:
lock: "pthread_mutex_lock" locks "m->lock".
/libvirt/src/datatypes.c:151:
missing_unlock: Returning without unlocking "conn->lock.lock".

Error: LOCK:
/libvirt/src/datatypes.c:406:
lock: "virMutexLock" locks "network->conn->lock.lock".
/libvirt/src/util/threads-pthread.c:85:
lock: "pthread_mutex_lock" locks "m->lock".
/libvirt/src/datatypes.c:413:
missing_unlock: Returning without unlocking "network->conn->lock.lock".

Error: LOCK:
/libvirt/src/datatypes.c:938:
lock: "virMutexLock" locks "dev->conn->lock.lock".
/libvirt/src/util/threads-pthread.c:85:
lock: "pthread_mutex_lock" locks "m->lock".
/libvirt/src/datatypes.c:945:
missing_unlock: Returning without unlocking "dev->conn->lock.lock".

Error: LOCK:
/libvirt/src/datatypes.c:1067:
lock: "virMutexLock" locks "secret->conn->lock.lock".
/libvirt/src/util/threads-pthread.c:85:
lock: "pthread_mutex_lock" locks "m->lock".
/libvirt/src/datatypes.c:1074:
missing_unlock: Returning without unlocking "secret->conn->lock.lock".

Error: LOCK:
/libvirt/src/datatypes.c:676:
lock: "virMutexLock" locks "pool->conn->lock.lock".
/libvirt/src/util/threads-pthread.c:85:
lock: "pthread_mutex_lock" locks "m->lock".
/libvirt/src/datatypes.c:683:
missing_unlock: Returning without unlocking "pool->conn->lock.lock".

Error: LOCK:
/libvirt/src/datatypes.c:820:
lock: "virMutexLock" locks "vol->conn->lock.lock".
/libvirt/src/util/threads-pthread.c:85:
lock: "pthread_mutex_lock" locks "m->lock".
/libvirt/src/datatypes.c:827:
missing_unlock: Returning without unlocking "vol->conn->lock.lock".

Error: LOCK:
/libvirt/src/datatypes.c:1351:
lock: "virMutexLock" locks "snapshot->domain->conn->lock.lock".
/libvirt/src/util/threads-pthread.c:85:
lock: "pthread_mutex_lock" locks "m->lock".
/libvirt/src/datatypes.c:1358:
missing_unlock: Returning without unlocking "snapshot->domain->conn->lock.lock".

Error: LOCK:
/libvirt/src/datatypes.c:542:
lock: "virMutexLock" locks "iface->conn->lock.lock".
/libvirt/src/util/threads-pthread.c:85:
lock: "pthread_mutex_lock" locks "m->lock".
/libvirt/src/datatypes.c:549:
missing_unlock: Returning without unlocking "iface->conn->lock.lock".

Error: LOCK:
/libvirt/src/datatypes.c:1260:
lock: "virMutexLock" locks "nwfilter->conn->lock.lock".
/libvirt/src/util/threads-pthread.c:85:
lock: "pthread_mutex_lock" locks "m->lock".
/libvirt/src/datatypes.c:1268:
missing_unlock: Returning without unlocking "nwfilter->conn->lock.lock".

Error: LOCK:
/libvirt/src/nwfilter/nwfilter_learnipaddr.c:180:
lock: "virMutexLock" locks "ifaceLock->lock.lock".
/libvirt/src/util/threads-pthread.c:85:
lock: "pthread_mutex_lock" locks "m->lock".
/libvirt/src/nwfilter/nwfilter_learnipaddr.c:182:
missing_unlock: Returning without unlocking "ifaceLock->lock.lock".

Error: NEGATIVE_RETURNS:
/libvirt/src/util/buf.c:147:
negative_return_fn: Function "virBufferGetIndent(buf, true)" returns a negative number.
/libvirt/src/util/buf.c:89:
return_negative_constant: Explicitly returning negative value "-1".
/libvirt/src/util/buf.c:147:
var_assign: Assigning: signed variable "indent" = "virBufferGetIndent".
/libvirt/src/util/buf.c:157:
negative_returns: "indent" is passed to a parameter that cannot be negative.

Error: NEGATIVE_RETURNS:
/libvirt/src/util/command.c:1609:
var_tested_neg: Variable "infd" tests negative.
/libvirt/src/util/command.c:1682:
negative_returns: "infd" is passed to a parameter that cannot be negative.

Error: NULL_RETURNS:
/libvirt/src/qemu/qemu_hostdev.c:243:
returned_null: Function "pciDeviceListFind" returns null (checked 9 out of 10 times).
/libvirt/src/util/pci.c:1572:
return_null: Explicitly returning NULL.
/libvirt/src/util/pci.c:512:
example_checked: "pciDeviceListFind(inactiveDevs, check)" has its value checked in "pciDeviceListFind(inactiveDevs, check)".
/libvirt/src/util/pci.c:751:
example_checked: "pciDeviceListFind(activeDevs, dev)" has its value checked in "pciDeviceListFind(activeDevs, dev)".
/libvirt/src/util/pci.c:1129:
example_checked: "pciDeviceListFind(activeDevs, dev)" has its value checked in "pciDeviceListFind(activeDevs, dev)".
/libvirt/src/util/pci.c:1148:
example_checked: "pciDeviceListFind(activeDevs, dev)" has its value checked in "pciDeviceListFind(activeDevs, dev)".
/libvirt/src/util/pci.c:1488:
example_checked: "pciDeviceListFind(list, dev)" has its value checked in "pciDeviceListFind(list, dev)".
/libvirt/src/qemu/qemu_hostdev.c:243:
var_assigned: Assigning: "activeDev" = null return value from "pciDeviceListFind".
/libvirt/src/qemu/qemu_hostdev.c:245:
dereference: Dereferencing a pointer that might be null "activeDev" when calling "pciDeviceSetUsedBy".
/libvirt/src/util/pci.c:1436:
deref_parm: Directly dereferencing parameter "dev".

Error: RETURN_LOCAL:
/libvirt/gnulib/lib/careadlinkat.c:101:
local_ptr_assign_local: Assigning: "buffer" = "stack_buf" (address of local variable "stack_buf").
/libvirt/gnulib/lib/careadlinkat.c:105:
local_ptr_assign_ptr: Assigning: "buf" = "buffer".
/libvirt/gnulib/lib/careadlinkat.c:152:
return_local_addr_alias: Returning pointer "buf" which points to local variable "stack_buf".

Error: REVERSE_INULL:
/libvirt/src/vbox/vbox_tmpl.c:1861:
deref_ptr_in_call: Dereferencing pointer "machineName". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
/libvirt/src/vbox/vbox_tmpl.c:1920:
check_after_deref: Dereferencing "machineName" before a null check.

Error: REVERSE_INULL:
/libvirt/src/vbox/vbox_tmpl.c:1373:
deref_ptr_in_call: Dereferencing pointer "machineNameUtf8". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
/libvirt/src/vbox/vbox_tmpl.c:1398:
check_after_deref: Dereferencing "machineNameUtf8" before a null check.

Error: REVERSE_INULL:
/libvirt/src/vbox/vbox_tmpl.c:1861:
deref_ptr_in_call: Dereferencing pointer "machineName". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
/libvirt/src/vbox/vbox_tmpl.c:1920:
check_after_deref: Dereferencing "machineName" before a null check.

Error: REVERSE_INULL:
/libvirt/src/vbox/vbox_tmpl.c:1373:
deref_ptr_in_call: Dereferencing pointer "machineNameUtf8". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
/libvirt/src/vbox/vbox_tmpl.c:1398:
check_after_deref: Dereferencing "machineNameUtf8" before a null check.

Error: REVERSE_INULL:
/libvirt/src/vbox/vbox_tmpl.c:1861:
deref_ptr_in_call: Dereferencing pointer "machineName". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
/libvirt/src/vbox/vbox_tmpl.c:1920:
check_after_deref: Dereferencing "machineName" before a null check.

Error: REVERSE_INULL:
/libvirt/src/vbox/vbox_tmpl.c:1373:
deref_ptr_in_call: Dereferencing pointer "machineNameUtf8". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
/libvirt/src/vbox/vbox_tmpl.c:1398:
check_after_deref: Dereferencing "machineNameUtf8" before a null check.

Error: REVERSE_INULL:
/libvirt/src/vbox/vbox_tmpl.c:1861:
deref_ptr_in_call: Dereferencing pointer "machineName". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
/libvirt/src/vbox/vbox_tmpl.c:1920:
check_after_deref: Dereferencing "machineName" before a null check.

Error: REVERSE_INULL:
/libvirt/src/vbox/vbox_tmpl.c:1373:
deref_ptr_in_call: Dereferencing pointer "machineNameUtf8". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
/libvirt/src/vbox/vbox_tmpl.c:1398:
check_after_deref: Dereferencing "machineNameUtf8" before a null check.

Error: REVERSE_INULL:
/libvirt/src/vbox/vbox_tmpl.c:1861:
deref_ptr_in_call: Dereferencing pointer "machineName". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
/libvirt/src/vbox/vbox_tmpl.c:1920:
check_after_deref: Dereferencing "machineName" before a null check.

Error: REVERSE_INULL:
/libvirt/src/vbox/vbox_tmpl.c:1373:
deref_ptr_in_call: Dereferencing pointer "machineNameUtf8". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
/libvirt/src/vbox/vbox_tmpl.c:1398:
check_after_deref: Dereferencing "machineNameUtf8" before a null check.

Error: REVERSE_INULL:
/libvirt/src/vbox/vbox_tmpl.c:1861:
deref_ptr_in_call: Dereferencing pointer "machineName". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
/libvirt/src/vbox/vbox_tmpl.c:1920:
check_after_deref: Dereferencing "machineName" before a null check.

Error: REVERSE_INULL:
/libvirt/src/vbox/vbox_tmpl.c:1373:
deref_ptr_in_call: Dereferencing pointer "machineNameUtf8". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
/libvirt/src/vbox/vbox_tmpl.c:1398:
check_after_deref: Dereferencing "machineNameUtf8" before a null check.


More information about the libvir-list mailing list