cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scan-ad...@coverity.com
Subject New Defects reported by Coverity Scan for cloudstack
Date Tue, 02 Jun 2015 12:15:52 GMT

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found with Coverity
Scan.

35 new defect(s) introduced to cloudstack found with Coverity Scan.
13 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 20 of 35 defect(s)


** CID 1302946:  Null pointer dereferences  (REVERSE_INULL)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixCreateVMSnapshotCommandWrapper.java:
107 in com.cloud.hypervisor.xenserver.resource.wrapper.xenbase.CitrixCreateVMSnapshotCommandWrapper.execute(com.cloud.agent.api.CreateVMSnapshotCommand,
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase)()


________________________________________________________________________________________________________
*** CID 1302946:  Null pointer dereferences  (REVERSE_INULL)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixCreateVMSnapshotCommandWrapper.java:
107 in com.cloud.hypervisor.xenserver.resource.wrapper.xenbase.CitrixCreateVMSnapshotCommandWrapper.execute(com.cloud.agent.api.CreateVMSnapshotCommand,
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase)()
101                     } catch (final Exception e) {
102                         if (!snapshotMemory) {
103                             vm = citrixResourceBase.createWorkingVM(conn, vmName, guestOSType,
platformEmulator, listVolumeTo);
104                         }
105                     }
106     
>>>     CID 1302946:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "vm" suggests that it may be null, but it has already been
dereferenced on all paths leading to the check.
107                     if (vm == null) {
108                         return new CreateVMSnapshotAnswer(command, false, "Creating VM
Snapshot Failed due to can not find vm: " + vmName);
109                     }
110     
111                     // call Xenserver API
112                     if (!snapshotMemory) {

** CID 1302947:  Resource leaks  (RESOURCE_LEAK)
/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/linux/MemStat.java: 57 in org.apache.cloudstack.utils.linux.MemStat.refresh()()


________________________________________________________________________________________________________
*** CID 1302947:  Resource leaks  (RESOURCE_LEAK)
/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/linux/MemStat.java: 57 in org.apache.cloudstack.utils.linux.MemStat.refresh()()
51         }
52     
53         public void refresh() {
54             try {
55                 Scanner fileScanner = new Scanner(new File(MEMINFO_FILE));
56                 parseFromScanner(fileScanner);
>>>     CID 1302947:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "fileScanner" going out of scope leaks the resource it refers to.
57             } catch (FileNotFoundException ex) {
58                 throw new RuntimeException("File " + MEMINFO_FILE + " not found:" + ex.toString());
59             }
60         }
61     
62         protected void parseFromScanner(Scanner scanner) {

** CID 1302948:  Exceptional resource leaks  (RESOURCE_LEAK)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
5029 in com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.createVmdataFiles(java.lang.String,
java.util.List, java.lang.String)()


________________________________________________________________________________________________________
*** CID 1302948:  Exceptional resource leaks  (RESOURCE_LEAK)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
5029 in com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.createVmdataFiles(java.lang.String,
java.util.List, java.lang.String)()
5023     
5024                             if (result && content != null && !content.isEmpty())
{
5025                                 try {
5026                                     File file = new File(folder+"/"+fileName+".txt");
5027                                     FileWriter fw = new FileWriter(file.getAbsoluteFile());
5028                                     BufferedWriter bw = new BufferedWriter(fw);
>>>     CID 1302948:  Exceptional resource leaks  (RESOURCE_LEAK)
>>>     Variable "fw" going out of scope leaks the resource it refers to.
5029                                     bw.write(content);
5030                                     bw.close();
5031                                     s_logger.debug("created file: "+ file + " in folder:"+folder);
5032                                 } catch (IOException ex) {
5033                                     s_logger.debug("Failed to create file "+ ex.getMessage());
5034                                     return false;

** CID 1302949:  Resource leaks  (RESOURCE_LEAK)
/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/linux/CPUStat.java: 56 in org.apache.cloudstack.utils.linux.CPUStat.getUptimeAndCpuIdleTime()()


________________________________________________________________________________________________________
*** CID 1302949:  Resource leaks  (RESOURCE_LEAK)
/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/linux/CPUStat.java: 56 in org.apache.cloudstack.utils.linux.CPUStat.getUptimeAndCpuIdleTime()()
50             _lastStats = getUptimeAndCpuIdleTime();
51         }
52     
53         private UptimeStats getUptimeAndCpuIdleTime() {
54             UptimeStats uptime = new UptimeStats(0d, 0d);
55             try {
>>>     CID 1302949:  Resource leaks  (RESOURCE_LEAK)
>>>     Ignoring resource created by "(new java.util.Scanner(new java.io.File("/proc/uptime"))).useDelimiter("\\Z")"
leaks it.
56                 String[] stats =  new Scanner(new File(_uptimeFile)).useDelimiter("\\Z").next().split("\\s+");
57                 uptime = new UptimeStats(Double.parseDouble(stats[0]), Double.parseDouble(stats[1]));
58             } catch (FileNotFoundException ex) {
59                 s_logger.warn("File " + _uptimeFile + " not found:" + ex.toString());
60             }
61             return uptime;

** CID 1302950:  Null pointer dereferences  (NULL_RETURNS)
/server/src/com/cloud/vm/UserVmManagerImpl.java: 1862 in com.cloud.vm.UserVmManagerImpl.loadVmDetailsInMapForExternalDhcpIp()()


________________________________________________________________________________________________________
*** CID 1302950:  Null pointer dereferences  (NULL_RETURNS)
/server/src/com/cloud/vm/UserVmManagerImpl.java: 1862 in com.cloud.vm.UserVmManagerImpl.loadVmDetailsInMapForExternalDhcpIp()()
1856         }
1857     
1858         private void loadVmDetailsInMapForExternalDhcpIp() {
1859     
1860             List<NetworkVO> networks = _networkDao.listByGuestType(Network.GuestType.Shared);
1861     
>>>     CID 1302950:  Null pointer dereferences  (NULL_RETURNS)
>>>     Calling a method on null object "networks".
1862             for (NetworkVO network: networks) {
1863                 if(_networkModel.isSharedNetworkWithoutServices(network.getId())) {
1864                     List<NicVO> nics = _nicDao.listByNetworkId(network.getId());
1865     
1866                     for (NicVO nic : nics) {
1867     

** CID 1302951:  Null pointer dereferences  (NULL_RETURNS)
/server/src/com/cloud/network/IpAddressManagerImpl.java: 1965 in com.cloud.network.IpAddressManagerImpl$12.doInTransactionWithoutResult(com.cloud.utils.db.TransactionStatus)()


________________________________________________________________________________________________________
*** CID 1302951:  Null pointer dereferences  (NULL_RETURNS)
/server/src/com/cloud/network/IpAddressManagerImpl.java: 1965 in com.cloud.network.IpAddressManagerImpl$12.doInTransactionWithoutResult(com.cloud.utils.db.TransactionStatus)()
1959     
1960                     // TODO: the IPv6 logic is not changed.
1961                     //FIXME - get ipv6 address from the placeholder if it's stored there
1962                     if (network.getIp6Gateway() != null) {
1963                         if (nic.getIp6Address() == null) {
1964                             UserIpv6Address ip = _ipv6Mgr.assignDirectIp6Address(dc.getId(),
vm.getOwner(), network.getId(), requestedIpv6);
>>>     CID 1302951:  Null pointer dereferences  (NULL_RETURNS)
>>>     Calling a method on null object "ip".
1965                             Vlan vlan = _vlanDao.findById(ip.getVlanId());
1966                             nic.setIp6Address(ip.getAddress().toString());
1967                             nic.setIp6Gateway(vlan.getIp6Gateway());
1968                             nic.setIp6Cidr(vlan.getIp6Cidr());
1969                             if (ipv4) {
1970                                 nic.setFormat(AddressFormat.DualStack);

** CID 1302952:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixGetVmIpAddressCommandWrapper.java:
55 in com.cloud.hypervisor.xenserver.resource.wrapper.xenbase.CitrixGetVmIpAddressCommandWrapper.execute(com.cloud.agent.api.GetVmIpAddressCommand,
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase)()


________________________________________________________________________________________________________
*** CID 1302952:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixGetVmIpAddressCommandWrapper.java:
55 in com.cloud.hypervisor.xenserver.resource.wrapper.xenbase.CitrixGetVmIpAddressCommandWrapper.execute(com.cloud.agent.api.GetVmIpAddressCommand,
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase)()
49             String errorMsg = null;
50             String vmIp = null;
51     
52             try {
53                 VM vm = citrixResourceBase.getVM(conn, vmName);
54                 VMGuestMetrics mtr = vm.getGuestMetrics(conn);
>>>     CID 1302952:  Null pointer dereferences  (NULL_RETURNS)
>>>     Calling a method on null object "mtr".
55                 VMGuestMetrics.Record rec = mtr.getRecord(conn);
56                 Map<String, String> vmIpsMap = rec.networks;
57     
58                 for (String ipAddr: vmIpsMap.values()) {
59                     if (NetUtils.isIpWithtInCidrRange(ipAddr, networkCidr)) {
60                         vmIp = ipAddr;

** CID 1302953:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixGetVmIpAddressCommandWrapper.java:
56 in com.cloud.hypervisor.xenserver.resource.wrapper.xenbase.CitrixGetVmIpAddressCommandWrapper.execute(com.cloud.agent.api.GetVmIpAddressCommand,
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase)()


________________________________________________________________________________________________________
*** CID 1302953:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixGetVmIpAddressCommandWrapper.java:
56 in com.cloud.hypervisor.xenserver.resource.wrapper.xenbase.CitrixGetVmIpAddressCommandWrapper.execute(com.cloud.agent.api.GetVmIpAddressCommand,
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase)()
50             String vmIp = null;
51     
52             try {
53                 VM vm = citrixResourceBase.getVM(conn, vmName);
54                 VMGuestMetrics mtr = vm.getGuestMetrics(conn);
55                 VMGuestMetrics.Record rec = mtr.getRecord(conn);
>>>     CID 1302953:  Null pointer dereferences  (NULL_RETURNS)
>>>     Accessing field of null object "rec".
56                 Map<String, String> vmIpsMap = rec.networks;
57     
58                 for (String ipAddr: vmIpsMap.values()) {
59                     if (NetUtils.isIpWithtInCidrRange(ipAddr, networkCidr)) {
60                         vmIp = ipAddr;
61                         break;

** CID 1302954:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtCreateCommandWrapper.java:
71 in com.cloud.hypervisor.kvm.resource.wrapper.LibvirtCreateCommandWrapper.execute(com.cloud.agent.api.storage.CreateCommand,
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource)()


________________________________________________________________________________________________________
*** CID 1302954:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtCreateCommandWrapper.java:
71 in com.cloud.hypervisor.kvm.resource.wrapper.LibvirtCreateCommandWrapper.execute(com.cloud.agent.api.storage.CreateCommand,
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource)()
65                     if (vol == null) {
66                         return new Answer(command, false, " Can't create storage volume
on storage pool");
67                     }
68                 } else {
69                     vol = primaryPool.createPhysicalDisk(dskch.getPath(), dskch.getProvisioningType(),
dskch.getSize());
70                 }
>>>     CID 1302954:  Null pointer dereferences  (NULL_RETURNS)
>>>     Calling a method on null object "vol".
71                 final VolumeTO volume =
72                         new VolumeTO(command.getVolumeId(), dskch.getType(), pool.getType(),
pool.getUuid(), pool.getPath(), vol.getName(), vol.getName(), disksize, null);
73     
74                 volume.setBytesReadRate(dskch.getBytesReadRate());
75                 volume.setBytesWriteRate(dskch.getBytesWriteRate());
76                 volume.setIopsReadRate(dskch.getIopsReadRate());

** CID 1302955:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtManageSnapshotCommandWrapper.java:
91 in com.cloud.hypervisor.kvm.resource.wrapper.LibvirtManageSnapshotCommandWrapper.execute(com.cloud.agent.api.ManageSnapshotCommand,
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource)()


________________________________________________________________________________________________________
*** CID 1302955:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtManageSnapshotCommandWrapper.java:
91 in com.cloud.hypervisor.kvm.resource.wrapper.LibvirtManageSnapshotCommandWrapper.execute(com.cloud.agent.api.ManageSnapshotCommand,
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource)()
85                     final String snapshot = snapshotXML.format(args);
86                     s_logger.debug(snapshot);
87                     if (command.getCommandSwitch().equalsIgnoreCase(ManageSnapshotCommand.CREATE_SNAPSHOT))
{
88                         vm.snapshotCreateXML(snapshot);
89                     } else {
90                         final DomainSnapshot snap = vm.snapshotLookupByName(snapshotName);
>>>     CID 1302955:  Null pointer dereferences  (NULL_RETURNS)
>>>     Calling a method on null object "snap".
91                         snap.delete(0);
92                     }
93     
94                     /*
95                      * libvirt on RHEL6 doesn't handle resume event emitted from
96                      * qemu

** CID 1302956:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtBackupSnapshotCommandWrapper.java:
174 in com.cloud.hypervisor.kvm.resource.wrapper.LibvirtBackupSnapshotCommandWrapper.execute(com.cloud.agent.api.BackupSnapshotCommand,
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource)()


________________________________________________________________________________________________________
*** CID 1302956:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtBackupSnapshotCommandWrapper.java:
174 in com.cloud.hypervisor.kvm.resource.wrapper.LibvirtBackupSnapshotCommandWrapper.execute(com.cloud.agent.api.BackupSnapshotCommand,
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource)()
168     
169                     final String vmUuid = vm.getUUIDString();
170                     final Object[] args = new Object[] {snapshotName, vmUuid};
171                     final String snapshot = snapshotXML.format(args);
172                     s_logger.debug(snapshot);
173                     final DomainSnapshot snap = vm.snapshotLookupByName(snapshotName);
>>>     CID 1302956:  Null pointer dereferences  (NULL_RETURNS)
>>>     Calling a method on null object "snap".
174                     snap.delete(0);
175     
176                     /*
177                      * libvirt on RHEL6 doesn't handle resume event emitted from
178                      * qemu
179                      */

** CID 1302957:  API usage errors  (INVALIDATE_ITERATOR)
/server/src/com/cloud/vm/UserVmManagerImpl.java: 2053 in com.cloud.vm.UserVmManagerImpl$VmIpFetchTask.runInContext()()


________________________________________________________________________________________________________
*** CID 1302957:  API usage errors  (INVALIDATE_ITERATOR)
/server/src/com/cloud/vm/UserVmManagerImpl.java: 2053 in com.cloud.vm.UserVmManagerImpl$VmIpFetchTask.runInContext()()
2047                 GlobalLock scanLock = GlobalLock.getInternLock("vmIpFetch");
2048     
2049                 try {
2050                     if (scanLock.lock(ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION)) {
2051                         try {
2052     
>>>     CID 1302957:  API usage errors  (INVALIDATE_ITERATOR)
>>>     Attempting to obtain another element from "vmIdCountMap.entrySet()" after
it's been modified.
2053                             for (Entry<Long, VmAndCountDetails> entry:   vmIdCountMap.entrySet())
{
2054                                 long nicId = entry.getKey();
2055                                 VmAndCountDetails vmIdAndCount = entry.getValue();
2056                                 long vmId = vmIdAndCount.getVmId();
2057     
2058                                 if (vmIdAndCount.getRetrievalCount() <= 0) {

** CID 1302959:  Null pointer dereferences  (FORWARD_NULL)
/server/src/com/cloud/network/NetworkModelImpl.java: 910 in com.cloud.network.NetworkModelImpl.isSharedNetworkWithoutServices(long)()


________________________________________________________________________________________________________
*** CID 1302959:  Null pointer dereferences  (FORWARD_NULL)
/server/src/com/cloud/network/NetworkModelImpl.java: 910 in com.cloud.network.NetworkModelImpl.isSharedNetworkWithoutServices(long)()
904             Network network = _networksDao.findById(networkId);
905     
906             if (network != null && network.getGuestType() != GuestType.Shared)
{
907                 return false;
908             }
909     
>>>     CID 1302959:  Null pointer dereferences  (FORWARD_NULL)
>>>     Calling a method on null object "network".
910             List<Service> services = listNetworkOfferingServices(network.getNetworkOfferingId());
911     
912             if (services == null || services.isEmpty()) {
913                 return true;
914             }
915     

** CID 1302960:  Null pointer dereferences  (FORWARD_NULL)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xen610/XenServer610MigrateWithStorageSendCommandWrapper.java:
104 in com.cloud.hypervisor.xenserver.resource.wrapper.xen610.XenServer610MigrateWithStorageSendCommandWrapper.execute(com.cloud.agent.api.MigrateWithStorageSendCommand,
com.cloud.hypervisor.xenserver.resource.XenServer610Resource)()


________________________________________________________________________________________________________
*** CID 1302960:  Null pointer dereferences  (FORWARD_NULL)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xen610/XenServer610MigrateWithStorageSendCommandWrapper.java:
104 in com.cloud.hypervisor.xenserver.resource.wrapper.xen610.XenServer610MigrateWithStorageSendCommandWrapper.execute(com.cloud.agent.api.MigrateWithStorageSendCommand,
com.cloud.hypervisor.xenserver.resource.XenServer610Resource)()
98                     } else {
99                         throw new CloudRuntimeException("The object " + networkObj + "
passed is not of type Network.");
100                     }
101                 }
102     
103                 // Check migration with storage is possible.
>>>     CID 1302960:  Null pointer dereferences  (FORWARD_NULL)
>>>     Calling a method on null object "vmToMigrate".
104                 task = vmToMigrate.assertCanMigrateAsync(connection, token, true, vdiMap,
vifMap, other);
105                 try {
106                     // poll every 1 seconds.
107                     final long timeout = xenServer610Resource.getMigrateWait() * 1000L;
108                     xenServer610Resource.waitForTask(connection, task, 1000, timeout);
109                     xenServer610Resource.checkForSuccess(connection, task);

** CID 1302961:  Null pointer dereferences  (FORWARD_NULL)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java:
173 in com.cloud.hypervisor.kvm.resource.wrapper.LibvirtMigrateCommandWrapper.execute(com.cloud.agent.api.MigrateCommand,
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource)()


________________________________________________________________________________________________________
*** CID 1302961:  Null pointer dereferences  (FORWARD_NULL)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java:
173 in com.cloud.hypervisor.kvm.resource.wrapper.LibvirtMigrateCommandWrapper.execute(com.cloud.agent.api.MigrateCommand,
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource)()
167                 }
168             }
169     
170             if (result != null) {
171             } else {
172                 libvirtComputingResource.destroyNetworkRulesForVM(conn, vmName);
>>>     CID 1302961:  Null pointer dereferences  (FORWARD_NULL)
>>>     Calling a method on null object "ifaces".
173                 for (final InterfaceDef iface : ifaces) {
174                     // We don't know which "traffic type" is associated with
175                     // each interface at this point, so inform all vif drivers
176                     final List<VifDriver> allVifDrivers = libvirtComputingResource.getAllVifDrivers();
177                     for (final VifDriver vifDriver : allVifDrivers) {
178                         vifDriver.unplug(iface);

** CID 1302962:  Null pointer dereferences  (FORWARD_NULL)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java:
65 in com.cloud.hypervisor.kvm.resource.wrapper.LibvirtMigrateCommandWrapper.execute(com.cloud.agent.api.MigrateCommand,
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource)()


________________________________________________________________________________________________________
*** CID 1302962:  Null pointer dereferences  (FORWARD_NULL)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java:
65 in com.cloud.hypervisor.kvm.resource.wrapper.LibvirtMigrateCommandWrapper.execute(com.cloud.agent.api.MigrateCommand,
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource)()
59             List<InterfaceDef> ifaces = null;
60             List<DiskDef> disks = null;
61     
62             Domain dm = null;
63             Connect dconn = null;
64             Domain destDomain = null;
>>>     CID 1302962:  Null pointer dereferences  (FORWARD_NULL)
>>>     Assigning: "conn" = "null".
65             Connect conn = null;
66             String xmlDesc = null;
67             try {
68                 final LibvirtUtilitiesHelper libvirtUtilitiesHelper = libvirtComputingResource.getLibvirtUtilitiesHelper();
69     
70                 conn = libvirtUtilitiesHelper.getConnectionByVmName(vmName);

** CID 1302963:  FindBugs: Performance  (FB.WMI_WRONG_MAP_ITERATOR)
/server/src/com/cloud/network/firewall/FirewallManagerImpl.java: 317 in com.cloud.network.firewall.FirewallManagerImpl.listFirewallRules(org.apache.cloudstack.api.command.user.firewall.IListFirewallRulesCmd)()


________________________________________________________________________________________________________
*** CID 1302963:  FindBugs: Performance  (FB.WMI_WRONG_MAP_ITERATOR)
/server/src/com/cloud/network/firewall/FirewallManagerImpl.java: 317 in com.cloud.network.firewall.FirewallManagerImpl.listFirewallRules(org.apache.cloudstack.api.command.user.firewall.IListFirewallRulesCmd)()
311     
312             if (tags != null && !tags.isEmpty()) {
313                 int count = 0;
314                 sc.setJoinParameters("tagSearch", "resourceType", ResourceObjectType.FirewallRule.toString());
315                 for (String key : tags.keySet()) {
316                     sc.setJoinParameters("tagSearch", "key" + String.valueOf(count), key);
>>>     CID 1302963:  FindBugs: Performance  (FB.WMI_WRONG_MAP_ITERATOR)
>>>     com.cloud.network.firewall.FirewallManagerImpl.listFirewallRules(IListFirewallRulesCmd)
makes inefficient use of keySet iterator instead of entrySet iterator
317                     sc.setJoinParameters("tagSearch", "value" + String.valueOf(count),
tags.get(key));
318                     count++;
319                 }
320             }
321     
322             if (display != null) {

** CID 1302964:  FindBugs: Performance  (FB.SIC_INNER_SHOULD_BE_STATIC)
/server/src/com/cloud/vm/UserVmManagerImpl.java: 545 in ()


________________________________________________________________________________________________________
*** CID 1302964:  FindBugs: Performance  (FB.SIC_INNER_SHOULD_BE_STATIC)
/server/src/com/cloud/vm/UserVmManagerImpl.java: 545 in ()
539         protected void resourceCountDecrement(long accountId, Boolean displayVm, Long
cpu, Long memory) {
540             _resourceLimitMgr.decrementResourceCount(accountId, ResourceType.user_vm,
displayVm);
541             _resourceLimitMgr.decrementResourceCount(accountId, ResourceType.cpu, displayVm,
cpu);
542             _resourceLimitMgr.decrementResourceCount(accountId, ResourceType.memory, displayVm,
memory);
543         }
544     
>>>     CID 1302964:  FindBugs: Performance  (FB.SIC_INNER_SHOULD_BE_STATIC)
>>>     Should com.cloud.vm.UserVmManagerImpl$VmAndCountDetails be a _static_ inner
class?
545         public class VmAndCountDetails {
546             long vmId;
547             int  retrievalCount = VmIpFetchTrialMax.value();
548     
549     
550             public VmAndCountDetails() {

** CID 1302965:  FindBugs: Performance  (FB.SIC_INNER_SHOULD_BE_STATIC)
/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/linux/CPUStat.java: 34 in ()


________________________________________________________________________________________________________
*** CID 1302965:  FindBugs: Performance  (FB.SIC_INNER_SHOULD_BE_STATIC)
/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/linux/CPUStat.java: 34 in ()
28     
29         private Integer _cores;
30         private UptimeStats _lastStats;
31         private final String _sysfsCpuDir = "/sys/devices/system/cpu";
32         private final String _uptimeFile = "/proc/uptime";
33     
>>>     CID 1302965:  FindBugs: Performance  (FB.SIC_INNER_SHOULD_BE_STATIC)
>>>     Should org.apache.cloudstack.utils.linux.CPUStat$UptimeStats be a _static_
inner class?
34         class UptimeStats {
35             public Double upTime = 0d;
36             public Double cpuIdleTime = 0d;
37     
38             public UptimeStats(Double upTime, Double cpuIdleTime) {
39                 this.upTime = upTime;

** CID 1302966:  FindBugs: Bad practice  (FB.RV_RETURN_VALUE_IGNORED_BAD_PRACTICE)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
5017 in com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.createVmdataFiles(java.lang.String,
java.util.List, java.lang.String)()


________________________________________________________________________________________________________
*** CID 1302966:  FindBugs: Bad practice  (FB.RV_RETURN_VALUE_IGNORED_BAD_PRACTICE)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
5017 in com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.createVmdataFiles(java.lang.String,
java.util.List, java.lang.String)()
5011                         if (folder != null && !folder.isEmpty()) {
5012                             File dir = new File(folder);
5013                             boolean result = true;
5014     
5015                             try {
5016                                 if (!dir.exists()) {
>>>     CID 1302966:  FindBugs: Bad practice  (FB.RV_RETURN_VALUE_IGNORED_BAD_PRACTICE)
>>>     exceptional return value of java.io.File.mkdirs() ignored
5017                                     dir.mkdirs();
5018                                 }
5019                             }catch (SecurityException ex) {
5020                                 s_logger.debug("Failed to create dir "+ ex.getMessage());
5021                                 return false;
5022                             }


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://scan.coverity.com/projects/943?tab=overview

To manage Coverity Scan email notifications for "dev@cloudstack.apache.org", click https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.org&token=494aabd5ba647999fa41b6d766646231
.


Mime
View raw message