1. 08 5月, 2012 6 次提交
    • E
      build: avoid link failure on Windows · 0ca336b3
      Eric Blake 提交于
      We only know -lpthread exists on platforms where we build
      threads-pthread.c; but when we build threads-win32.c, LIB_PTHREAD
      is empty.
      
      * tests/Makefile.am (shunloadtest_LDADD): Use correct library.
      0ca336b3
    • J
      virsh: avoid heap corruption leading to virsh abort · c6694ab8
      Jim Meyering 提交于
      * tools/virsh.c (vshParseSnapshotDiskspec): Fix off-by-3 memmove
      that would corrupt heap when parsing escaped --diskspec comma.
      Bug introduced via commit v0.9.4-260-g35d52b56.
      c6694ab8
    • L
      util: set src_pid for virNetlinkCommand when appropriate · cc073771
      Laine Stump 提交于
      Until now, the nl_pid of the source address of every message sent by
      virNetlinkCommand has been set to the value of getpid(). Most of the
      time this doesn't matter, and in the one case where it does
      (communication with lldpad), it previously was the proper thing to do,
      because the netlink event service (which listens on a netlink socket
      for unsolicited messages from lldpad) coincidentally always happened
      to bind with a local nl_pid == getpid().
      
      With the fix for:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=816465
      
      that particular nl_pid is now effectively a reserved value, so the
      netlink event service will always bind to something else
      (coincidentally "getpid() + (1 << 22)", but it really could be
      anything). The result is that communication between lldpad and
      libvirtd is broken (lldpad gets a "disconnected" error when it tries
      to send a directed message).
      
      The solution to this problem caused by a solution, is to query the
      netlink event service's nlhandle for its "local_port", and send that
      as the source nl_pid (but only when sending to lldpad, of course - in
      other cases we maintain the old behavior of sending getpid()).
      
      There are two cases where a message is being directed at lldpad - one
      in virNetDevLinkDump, and one in virNetDevVPortProfileOpSetLink.
      
      The case of virNetDevVPortProfileOpSetLink is simplest to explain -
      only if !nltarget_kernel, i.e. the message isn't targetted for the
      kernel, is the dst_pid set (by calling
      virNetDevVPortProfileGetLldpadPid()), so only in that case do we call
      virNetlinkEventServiceLocalPid() to set src_pid.
      
      For virNetDevLinkDump, it's a bit more complicated. The call to
      virNetDevVPortProfileGetLldpadPid() was effectively up one level (in
      virNetDevVPortProfileOpCommon), although obscured by an unnecessary
      passing of a function pointer. This patch removes the function
      pointer, and calls virNetDevVPortProfileGetLldpadPid() directly in
      virNetDevVPortProfileOpCommon - if it's doing this, it knows that it
      should also call virNetlinkEventServiceLocalPid() to set src_pid too;
      then it just passes src_pid and dst_pid down to
      virNetDevLinkDump. Since (src_pid == 0 && dst_pid == 0) implies that
      the kernel is the destination, there is no longer any need to send
      nltarget_kernel as an arg to virNetDevLinkDump, so it's been removed.
      
      The disparity between src_pid being int and dst_pid being uint32_t may
      be a bit disconcerting to some, but I didn't want to complicate
      virNetlinkEventServiceLocalPid() by having status returned separately
      from the value.
      cc073771
    • L
      util: function to get local nl_pid used by netlink event socket · c99e9375
      Laine Stump 提交于
      This value will be needed to set the src_pid when sending netlink
      messages to lldpad. It is part of the solution to:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=816465
      
      Note that libnl's port generation algorithm guarantees that the
      nl_socket_get_local_port() will always be > 0 (since it is "getpid() +
      (n << 22>" where n is always < 1024), so it is okay to cast the
      uint32_t to int (thus allowing us to use -1 as an error sentinel).
      c99e9375
    • L
      util: allow specifying both src and dst pid in virNetlinkCommand · cca7bb1f
      Laine Stump 提交于
      Until now, virNetlinkCommand has assumed that the nl_pid in the source
      address of outgoing netlink messages should always be the return value
      of getpid(). In most cases it actually doesn't matter, but in the case
      of communication with lldpad, lldpad saves this info and later uses it
      to send netlink messages back to libvirt. A recent patch to fix Bug
      816465 changed the order of the universe such that the netlink event
      service socket is no longer bound with nl_pid == getpid(), so lldpad
      could no longer send unsolicited messages to libvirtd. Adding src_pid
      as an argument to virNetlinkCommand() is the first step in notifying
      lldpad of the proper address of the netlink event service socket.
      cca7bb1f
    • L
      util: fix libvirtd startup failure due to netlink error · 64297313
      Laine Stump 提交于
      This is part of the solution to the problem detailed in:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=816465
      
      and further detailed in
      
        https://www.redhat.com/archives/libvir-list/2012-May/msg00202.htm
      
      A short explanation is included in the comments of the patch itself.
      
      Note that this patch by itself breaks communication between lldpad and
      libvirtd, so the other 3 patches in the series must be applied at the
      same time as this patch.
      64297313
  2. 07 5月, 2012 6 次提交
    • G
      f300c194
    • G
      qemu: call usb search function for hostdev initialization and hotplug · 05abd150
      Guannan Ren 提交于
      src/qemu/qemu_hostdev.c:
      refactor qemuPrepareHostdevUSBDevices function, make it focus on
      adding usb device to activeUsbHostdevs after check. After that,
      the usb hotplug function qemuDomainAttachHostDevice also could use
      it.
      expand qemuPrepareHostUSBDevices to perform the usb search,
      rollback on failure.
      
      src/qemu/qemu_hotplug.c:
      If there are multiple usb devices available with same vendorID and productID,
      but with different value of "bus, device", we give an error to let user
      use <address> to specify the desired one.
      05abd150
    • G
      usb: create functions to search usb device accurately · 9914477e
      Guannan Ren 提交于
      usbFindDevice():get usb device according to
                      idVendor, idProduct, bus, device
                      it is the exact match of the four parameters
      
      usbFindDeviceByBus():get usb device according to bus, device
                        it returns only one usb device same as usbFindDevice
      
      usbFindDeviceByVendor():get usb device according to idVendor,idProduct
                           it probably returns multiple usb devices.
      
      usbDeviceSearch(): a helper function to do the actual search
      9914477e
    • C
      f4345ac2
    • C
      0cb72f25
    • J
      qemu: Emit compatible XML when migrating a domain · 409b5f54
      Jiri Denemark 提交于
      When we added the default USB controller into domain XML, we efficiently
      broke migration to older versions of libvirt that didn't support USB
      controllers at all (0.9.4 and earlier) even for domains that don't use
      anything that the older libvirt can't provide. We still want to present
      the default USB controller in any XML seen by a user/app but we can
      safely remove it from the domain XML used during migration. If we are
      migrating to a new enough libvirt, it will add the controller XML back,
      while older libvirt won't be confused with it although it will still
      tell qemu to create the controller.
      
      Similar approach can be used in the future whenever we find out we
      always enabled some kind of device without properly advertising it in
      domain XML.
      409b5f54
  3. 05 5月, 2012 6 次提交
    • J
      qemu: Don't use virDomainDefFormat* directly · cd603008
      Jiri Denemark 提交于
      Always use appropriate qemuDomain{,Def}Format wrapper since it may do
      some additional magic based on the flags.
      cd603008
    • E
      qemu: reject blockiotune if qemu too old · 13f9a193
      Eric Blake 提交于
      Commit 4c82f09e added a capability check for qemu per-device io
      throttling, but only applied it to domain startup.  As mentioned
      in the previous commit (98cec052), the user can still get an 'internal
      error' message during a hotplug attempt, when the monitor command
      doesn't exist.  It is confusing to allow tuning on inactive domains
      only to then be rejected when starting the domain.
      
      * src/qemu/qemu_driver.c (qemuDomainSetBlockIoTune): Reject
      offline tuning if online can't match it.
      13f9a193
    • E
      qemu: don't modify domain on failed blockiotune · 98cec052
      Eric Blake 提交于
      If you have a qemu build that lacks the blockio tune monitor command,
      then this command:
      
      $ virsh blkdeviotune rhel6u2 hda --total_bytes_sec 1000
      error: Unable to change block I/O throttle
      error: internal error Unexpected error
      
      fails as expected (well, the error message is lousy), but the next
      dumpxml shows that the domain was modified anyway.  Worse, that means
      if you save the domain then restore it, the restore will likely fail
      due to throttling being unsupported, even though no throttling should
      even be active because the monitor command failed in the first place.
      
      * src/qemu/qemu_driver.c (qemuDomainSetBlockIoTune): Check for
      error before making modification permanent.
      98cec052
    • L
      util: remove error log from stubs of virNetlinkEventServiceStart|Stop · bae4ff28
      Laine Stump 提交于
      These two functions are called from main() on all platforms, and
      always return success on platforms that don't support libnl. They
      still log an error message, though, which doesn't make sense - they
      should just be NOPs on those platforms. (Per a suggestion during
      review, I've turned the logs into debug messages rather than removing
      them completely).
      bae4ff28
    • S
      node_device: fix possible non-terminated string · 43d1616f
      Stefan Berger 提交于
      Error: STRING_NULL:
      /libvirt/src/node_device/node_device_linux_sysfs.c:80:
      string_null_argument: Function "saferead" does not terminate string "*buf".
      /libvirt/src/util/util.c:101:
      string_null_argument: Function "read" fills array "*buf" with a non-terminated string.
      /libvirt/src/node_device/node_device_linux_sysfs.c:87:
      string_null: Passing unterminated string "buf" to a function expecting a null-terminated string.
      43d1616f
    • S
      uuid: fix possible non-terminated string · b4586051
      Stefan Berger 提交于
      Error: STRING_NULL:
      /libvirt/src/util/uuid.c:273:
      string_null_argument: Function "getDMISystemUUID" does not terminate string "*dmiuuid".
      /libvirt/src/util/uuid.c:241:
      string_null_argument: Function "saferead" fills array "*uuid" with a non-terminated string.
      /libvirt/src/util/util.c:101:
      string_null_argument: Function "read" fills array "*buf" with a non-terminated string.
      /libvirt/src/util/uuid.c:274:
      string_null: Passing unterminated string "dmiuuid" to a function expecting a null-terminated string.
      /libvirt/src/util/uuid.c:138:
      var_assign_parm: Assigning: "cur" = "uuidstr". They now point to the same thing.
      /libvirt/src/util/uuid.c:164:
      string_null_sink_loop: Searching for null termination in an unterminated array "cur".
      b4586051
  4. 04 5月, 2012 13 次提交
    • S
      tests: fix resource leak · a01e6721
      Stefan Berger 提交于
      Error: RESOURCE_LEAK:
      /libvirt/tests/qemuxml2argvtest.c:47:
      alloc_arg: Calling allocation function "virAlloc" on "ret".
      /libvirt/src/util/memory.c:101:
      alloc_fn: Storage is returned from allocation function "calloc".
      /libvirt/src/util/memory.c:101:
      var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
      /libvirt/tests/qemuxml2argvtest.c:54:
      leaked_storage: Variable "ret" going out of scope leaks the storage it points to.
      a01e6721
    • S
      qemu: fix resource leak · c0774482
      Stefan Berger 提交于
      Error: RESOURCE_LEAK:
      /libvirt/src/qemu/qemu_driver.c:6968:
      alloc_fn: Calling allocation function "calloc".
      /libvirt/src/qemu/qemu_driver.c:6968:
      var_assign: Assigning: "nodeset" =  storage returned from "calloc(1UL, 1UL)".
      /libvirt/src/qemu/qemu_driver.c:6977:
      noescape: Variable "nodeset" is not freed or pointed-to in function "virTypedParameterAssign".
      /libvirt/src/qemu/qemu_driver.c:6997:
      leaked_storage: Variable "nodeset" going out of scope leaks the storage it points to.
      c0774482
    • S
      vmx: fix resource leak · 409a637e
      Stefan Berger 提交于
      Error: RESOURCE_LEAK:
      /libvirt/src/vmx/vmx.c:2431:
      alloc_fn: Calling allocation function "calloc".
      /libvirt/src/vmx/vmx.c:2431:
      var_assign: Assigning: "networkName" =  storage returned from "calloc(1UL, 1UL)".
      /libvirt/src/vmx/vmx.c:2495:
      leaked_storage: Variable "networkName" going out of scope leaks the storage it points to.
      409a637e
    • G
      1cbe658b
    • O
      Coverity: Fix resource leak in virnetlink.c · fd2b4157
      Osier Yang 提交于
      fd2b4157
    • O
      Coverity: Fix resource leak in nodeinfo.c · 739cfc31
      Osier Yang 提交于
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:629: alloc_fn: Calling allocation function "fopen".
      /builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:629: var_assign: Assigning: "cpuinfo" =  storage returned from "fopen("/proc/cpuinfo", "r")".
      /builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:638: leaked_storage: Variable "cpuinfo" going out of scope leaks the storage it points to.
      739cfc31
    • O
      Coverity: Fix resource leak in test driver · ad4d4ad0
      Osier Yang 提交于
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/test/test_driver.c:1041: alloc_arg: Calling allocation function "virXPathNodeSet" on "devs".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/xml.c:621: alloc_arg: "virAllocN" allocates memory that is stored into "*list".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:129: alloc_fn: Storage is returned from allocation function "calloc".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:129: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(count, size)".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/xml.c:625: noescape: Variable "*list" is not freed or pointed-to in function "memcpy".
      /builddir/build/BUILD/libvirt-0.9.10/src/test/test_driver.c:1098: leaked_storage: Variable "devs" going out of scope leaks the storage it points to.
      ad4d4ad0
    • O
      Coverity: Fix resource leak in xen driver · e91e0ab6
      Osier Yang 提交于
      Coverity logs:
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_inotify.c:103: alloc_fn: Calling allocation function "xenDaemonLookupByUUID".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xend_internal.c:2534: alloc_fn: Storage is returned from allocation function "virGetDomain".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:191: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:210: return_alloc: Returning allocated memory "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xend_internal.c:2534: var_assign: Assigning: "ret" = "virGetDomain(conn, name, uuid)".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xend_internal.c:2541: return_alloc: Returning allocated memory "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_inotify.c:103: var_assign: Assigning: "dom" =  storage returned from "xenDaemonLookupByUUID(conn, rawuuid)".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_inotify.c:126: leaked_storage: Variable "dom" going out of scope leaks the storage it points to.
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2742: alloc_fn: Calling allocation function "fopen".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2742: var_assign: Assigning: "cpuinfo" =  storage returned from "fopen("/proc/cpuinfo", "r")".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2763: noescape: Variable "cpuinfo" is not freed or pointed-to in function "xenHypervisorMakeCapabilitiesInternal".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2574:45: noescape: "xenHypervisorMakeCapabilitiesInternal" does not free or save its pointer parameter "cpuinfo".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2768: leaked_storage: Variable "cpuinfo" going out of scope leaks the storage it points to.
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2752: alloc_fn: Calling allocation function "fopen".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2752: var_assign: Assigning: "capabilities" =  storage returned from "fopen("/sys/hypervisor/properties/capabilities", "r")".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2763: noescape: Variable "capabilities" is not freed or pointed-to in function "xenHypervisorMakeCapabilitiesInternal".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2574:60: noescape: "xenHypervisorMakeCapabilitiesInternal" does not free or save its pointer parameter "capabilities".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2768: leaked_storage: Variable "capabilities" going out of scope leaks the storage it points to.
      e91e0ab6
    • O
      Coverity: Fix resource leaks in phyp driver · cff0d342
      Osier Yang 提交于
      Coverity logs:
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:523: alloc_fn: Calling allocation function "fopen".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:523: var_assign: Assigning: "fd" =  storage returned from "fopen(local_file, "rb")".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:540: noescape: Variable "fd" is not freed or pointed-to in function "fread".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:542: noescape: Variable "fd" is not freed or pointed-to in function "feof".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:575: leaked_storage: Variable "fd" going out of scope leaks the storage it points to.
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:585: leaked_storage: Variable "fd" going out of scope leaks the storage it points to.
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2088: alloc_fn: Calling allocation function "phypVolumeLookupByName".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2026: alloc_fn: Storage is returned from allocation function "virGetStorageVol".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:724: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:753: return_alloc: Returning allocated memory "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2026: var_assign: Assigning: "vol" = "virGetStorageVol(pool->conn, pool->name, volname, key)".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2030: return_alloc: Returning allocated memory "vol".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2088: leaked_storage: Failing to save storage allocated by "phypVolumeLookupByName(pool, voldef->name)" leaks it.
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2725: alloc_fn: Calling allocation function "phypGetStoragePoolLookUpByUUID".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2689: alloc_fn: Storage is returned from allocation function "virGetStoragePool".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:592: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:610: return_alloc: Returning allocated memory "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2689: var_assign: Assigning: "sp" = "virGetStoragePool(conn, pools[i], uuid)".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2694: return_alloc: Returning allocated memory "sp".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2725: leaked_storage: Failing to save storage allocated by "phypGetStoragePoolLookUpByUUID(conn, def->uuid)" leaks it.
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2719: alloc_fn: Calling allocation function "phypStoragePoolLookupByName".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2254: alloc_fn: Storage is returned from allocation function "virGetStoragePool".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:592: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:610: return_alloc: Returning allocated memory "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2254: return_alloc_fn: Directly returning storage allocated by "virGetStoragePool".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2719: leaked_storage: Failing to save storage allocated by "phypStoragePoolLookupByName(conn, def->name)" leaks it.
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2270: alloc_fn: Calling allocation function "phypStoragePoolLookupByName".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2254: alloc_fn: Storage is returned from allocation function "virGetStoragePool".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:592: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:610: return_alloc: Returning allocated memory "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2254: return_alloc_fn: Directly returning storage allocated by "virGetStoragePool".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2270: var_assign: Assigning: "sp" =  storage returned from "phypStoragePoolLookupByName(vol->conn, vol->pool)".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2324: leaked_storage: Variable "sp" going out of scope leaks the storage it points to.
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2327: leaked_storage: Variable "sp" going out of scope leaks the storage it points t
      cff0d342
    • O
      Coverity: Fix the forward_null error in Python binding codes · b80f4db9
      Osier Yang 提交于
      Related coverity log:
      
      Error: FORWARD_NULL:
      /builddir/build/BUILD/libvirt-0.9.10/python/libvirt-override.c:355:
      assign_zero: Assigning: "params" = 0.
      /builddir/build/BUILD/libvirt-0.9.10/python/libvirt-override.c:458:
      var_deref_model: Passing null variable "params" to function
      "getPyVirTypedParameter", which dereferences it. (The dereference is assumed on
      the basis of the 'nonnull' parameter attribute.)
      b80f4db9
    • E
      qemu: avoid 32-bit compiler warning · cdce2f42
      Eric Blake 提交于
      On 32-bit platforms, gcc warns that the comparison between a long
      and (ULLONG_MAX/1024/1024) is always false; throwing in a type
      conversion shuts up the warning.
      
      * src/qemu/qemu_monitor.c (qemuMonitorBlockJob): Shut gcc up.
      cdce2f42
    • S
      build: support libnl-3 · 60fb8a22
      Serge Hallyn 提交于
      configure.ac: check for libnl-3 in addition to libnl-1
      
      src/Makefile.am: link against libnl when needed
      
      src/util/virnetlink.c:
      support libnl3 api.  To minimize impact on code flow, wrap the
      differences under the virNetlink* namespace.
      
      Unfortunately libnl3 moves netlink/msg.h to
      /usr/include/libnl3/netlink/msg.h, so the LIBNL_CFLAGS need to be added
      to a bunch of places where they weren't needed with libnl1.
      Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      60fb8a22
    • E
      build: fix build on cygwin · c8982638
      Eric Blake 提交于
      On cygwin, <rpc/rpc.h> lives in a different directory than
      /usr/include, so anything that uses it must modify CFLAGS.  This
      previously tripped up just 'make check', but now that we build
      all test programs unconditionally, it also trips up 'make'.
      
      * tests/Makefile.am (virnetmessagetest_CFLAGS): Find rpc headers.
      c8982638
  5. 03 5月, 2012 5 次提交
  6. 02 5月, 2012 3 次提交
    • E
      virsh: output scaled values with correct units · 706aa7c5
      Eric Blake 提交于
      The recent push to use correct scaling terms (kB for 1000, KiB for
      1024 - such as commit 9dfdeadc) missed some places in virsh.
      
      * tools/virsh.c (prettyCapacity, cmdDominfo, cmdFreecell)
      (cmdNodeinfo, cmdNodeMemStats, cmdMigrateSetMaxSpeed)
      (cmdBlockCopy, cmdBlockPull, cmdBlockJob): Use KiB, not kB, when
      referring to multiples of 1024.
      * tests/virshtest.c: Update expected output to match.
      706aa7c5
    • E
      virsh: make -h always give help · 46e5d36b
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=817244 mentions that
      unlike most other tools, where --help or --version prevent all
      further parsing of all later options, virsh was strange in that
      --version stopped parsing but --help tried to plow on to the end.
      There was no rationale for this original implementation (since
      2005!), so I think we can safely conform to common usage patterns.
      
      * tools/virsh.c (main): Drop useless 'help' variable.
      46e5d36b
    • L
      build: make ATTRIBUTE_NONNULL() a NOP unless STATIC_ANALYSIS is on · eefb881d
      Laine Stump 提交于
      The ATTRIBUTE_NONNULL(m) macro normally resolves to the gcc builtin
      __attribute__((__nonnull__(m))). The effect of this in gcc is
      unfortunately only to make gcc believe that "m" can never possibly be
      NULL, *not* to add in any checks to guarantee that it isn't ever NULL
      (i.e. it is an optimization aid, *not* something to verify code
      correctness.) - see the following gcc bug report for more details:
      
        http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17308
      
      Static source analyzers such as clang and coverity apparently can use
      ATTRIBUTE_NONNULL(), though, to detect dead code (in the case that the
      arg really is guaranteed non-NULL), as well as situations where an
      obviously NULL arg is given to the function.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=815270 is a good example
      of a bug caused by erroneous application of ATTRIBUTE_NONNULL().
      Several people spent a long time staring at this code and not finding
      the problem, because the problem wasn't in the function itself, but in
      the prototype that specified ATTRIBUTE_NONNULL() for an arg that
      actually *wasn't* always non-NULL, and caused a segv when dereferenced
      (even though the code that dereferenced the pointer was inside an if()
      that checked for a NULL pointer, that code was optimized out by gcc).
      
      There may be some very small gain to be had from the optimizations
      that can be inferred from ATTRIBUTE_NONNULL(), but it seems safer to
      err on the side of generating code that behaves as expected, while
      turning on the attribute for static analyzers.
      eefb881d
  7. 01 5月, 2012 1 次提交