Hi,
Please find the latest report on new defect(s) introduced to cloudstack found
with Coverity Scan.
15 new defect(s) introduced to cloudstack found with Coverity Scan.
52 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 15 of 15 defect(s)
** CID 1249790: Dereference after null check (FORWARD_NULL)
/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java:
993 in
org.apache.cloudstack.secondarystorage.SecondaryStorageManagerImpl.destroySecStorageVm(long)()
** CID 1249792: Explicit null dereferenced (FORWARD_NULL)
/server/src/com/cloud/network/rules/DhcpSubNetRules.java: 142 in
com.cloud.network.rules.DhcpSubNetRules.accept(org.apache.cloudstack.network.topology.NetworkTopologyVisitor,
com.cloud.network.router.VirtualRouter)()
** CID 1249789: Dereference null return value (NULL_RETURNS)
/server/src/com/cloud/api/ApiResponseHelper.java: 508 in
com.cloud.api.ApiResponseHelper.getDataStoreRole(com.cloud.storage.Snapshot)()
** CID 1249786: Dereference null return value (NULL_RETURNS)
/server/src/com/cloud/template/TemplateManagerImpl.java: 1486 in
com.cloud.template.TemplateManagerImpl.getDataStoreRole(com.cloud.storage.Snapshot)()
** CID 1249793: Dereference null return value (NULL_RETURNS)
/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java:
408 in
org.apache.cloudstack.storage.snapshot.StorageSystemSnapshotStrategy.canHandle(com.cloud.storage.Snapshot,
org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy$SnapshotOperation)()
** CID 1249791: Dereference null return value (NULL_RETURNS)
/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java:
118 in
org.apache.cloudstack.api.command.user.firewall.DeleteEgressFirewallRuleCmd.getSyncObjId()()
** CID 1249787: Dereference null return value (NULL_RETURNS)
/server/src/com/cloud/network/router/VpcNetworkHelperImpl.java: 91 in
com.cloud.network.router.VpcNetworkHelperImpl.createRouterNetworks(org.cloud.network.router.deployment.RouterDeploymentDefinition)()
** CID 1249800: RE: Regular expressions (FB.RE_POSSIBLE_UNINTENDED_PATTERN)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java:
3614 in
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.getOsVersion()()
** CID 1249801: ES: Checking String equality using == or !=
(FB.ES_COMPARING_STRINGS_WITH_EQ)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java:
221 in com.cloud.hypervisor.kvm.resource.LibvirtVMDef$FeaturesDef.toString()()
** CID 1249803: DLS: Dead local store (FB.DLS_DEAD_LOCAL_STORE)
/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java:
933 in
com.cloud.network.resource.NetscalerResource.execute(com.cloud.agent.api.routing.CreateLoadBalancerApplianceCommand,
int)()
** CID 1249802: DLS: Dead local store (FB.DLS_DEAD_LOCAL_STORE)
/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java:
1924 in
com.cloud.network.router.VirtualNetworkApplianceManagerImpl.createDefaultEgressFirewallRule(java.util.List,
long)()
** CID 1249796: WMI: Inefficient Map Iterator (FB.WMI_WRONG_MAP_ITERATOR)
/server/src/com/cloud/network/rules/NicPlugInOutRules.java: 97 in
com.cloud.network.rules.NicPlugInOutRules.accept(org.apache.cloudstack.network.topology.NetworkTopologyVisitor,
com.cloud.network.router.VirtualRouter)()
** CID 1249794: UuF: Unused field (FB.UUF_UNUSED_FIELD)
/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java:
1620 in ()
** CID 1249798: SIC: Inner class could be made static
(FB.SIC_INNER_SHOULD_BE_STATIC)
/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinitionBuilder.java:
154 in ()
** CID 1249797: UrF: Unread field (FB.URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD)
/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinitionBuilder.java:
164 in ()
________________________________________________________________________________________________________
*** CID 1249790: Dereference after null check (FORWARD_NULL)
/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java:
993 in
org.apache.cloudstack.secondarystorage.SecondaryStorageManagerImpl.destroySecStorageVm(long)()
________________________________________________________________________________________________________
*** CID 1249792: Explicit null dereferenced (FORWARD_NULL)
/server/src/com/cloud/network/rules/DhcpSubNetRules.java: 142 in
com.cloud.network.rules.DhcpSubNetRules.accept(org.apache.cloudstack.network.topology.NetworkTopologyVisitor,
com.cloud.network.router.VirtualRouter)()
136 s_logger.info("unable to configure dhcp for this
VM.");
137 return false;
138 }
139 // this means we did not create an IP alias on the
router.
140 _nicAlias = new NicIpAliasVO(domrGuestNic.getId(),
_routerAliasIp, _router.getId(), CallContext.current().getCallingAccountId(),
_network.getDomainId(),
141 _nic.getNetworkId(), _nic.getGateway(),
_nic.getNetmask());
>>> CID 1249792: Explicit null dereferenced (FORWARD_NULL)
>>> Calling a method on null object "routerPublicIP".
142
_nicAlias.setAliasCount(routerPublicIP.getIpMacAddress());
143 nicIpAliasDao.persist(_nicAlias);
144
145 final boolean result = visitor.visit(this);
146
147 if (result == false) {
________________________________________________________________________________________________________
*** CID 1249789: Dereference null return value (NULL_RETURNS)
/server/src/com/cloud/api/ApiResponseHelper.java: 508 in
com.cloud.api.ApiResponseHelper.getDataStoreRole(com.cloud.storage.Snapshot)()
502
503 long storagePoolId = volumeVO.getPoolId();
504 DataStore dataStore = _dataStoreMgr.getDataStore(storagePoolId,
DataStoreRole.Primary);
505
506 Map<String, String> mapCapabilities =
dataStore.getDriver().getCapabilities();
507
>>> CID 1249789: Dereference null return value (NULL_RETURNS)
>>> Calling a method on null object "mapCapabilities".
508 String value =
mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
509 Boolean supportsStorageSystemSnapshots = new Boolean(value);
510
511 if (supportsStorageSystemSnapshots) {
512 return DataStoreRole.Primary;
513 }
________________________________________________________________________________________________________
*** CID 1249786: Dereference null return value (NULL_RETURNS)
/server/src/com/cloud/template/TemplateManagerImpl.java: 1486 in
com.cloud.template.TemplateManagerImpl.getDataStoreRole(com.cloud.storage.Snapshot)()
1480
1481 long storagePoolId = volumeVO.getPoolId();
1482 DataStore dataStore =
_dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
1483
1484 Map<String, String> mapCapabilities =
dataStore.getDriver().getCapabilities();
1485
>>> CID 1249786: Dereference null return value (NULL_RETURNS)
>>> Calling a method on null object "mapCapabilities".
1486 String value =
mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
1487 Boolean supportsStorageSystemSnapshots = new Boolean(value);
1488
1489 if (supportsStorageSystemSnapshots) {
1490 return DataStoreRole.Primary;
1491 }
________________________________________________________________________________________________________
*** CID 1249793: Dereference null return value (NULL_RETURNS)
/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java:
408 in
org.apache.cloudstack.storage.snapshot.StorageSystemSnapshotStrategy.canHandle(com.cloud.storage.Snapshot,
org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy$SnapshotOperation)()
402
403 long storagePoolId = volumeVO.getPoolId();
404 DataStore dataStore = _dataStoreMgr.getDataStore(storagePoolId,
DataStoreRole.Primary);
405
406 Map<String, String> mapCapabilities =
dataStore.getDriver().getCapabilities();
407
>>> CID 1249793: Dereference null return value (NULL_RETURNS)
>>> Calling a method on null object "mapCapabilities".
408 String value =
mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
409 Boolean supportsStorageSystemSnapshots = new Boolean(value);
410
411 if (supportsStorageSystemSnapshots) {
412 return StrategyPriority.HIGHEST;
413 }
414
415 return StrategyPriority.CANT_HANDLE;
416 }
________________________________________________________________________________________________________
*** CID 1249791: Dereference null return value (NULL_RETURNS)
/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java:
118 in
org.apache.cloudstack.api.command.user.firewall.DeleteEgressFirewallRuleCmd.getSyncObjId()()
112 public String getSyncObjType() {
113 return BaseAsyncCmd.networkSyncObject;
114 }
115
116 @Override
117 public Long getSyncObjId() {
>>> CID 1249791: Dereference null return value (NULL_RETURNS)
>>> Calling a method on null object "_firewallService.getFirewallRule(id)".
118 return _firewallService.getFirewallRule(id).getNetworkId();
119 }
120
121 @Override
122 public ApiCommandJobType getInstanceType() {
123 return ApiCommandJobType.FirewallRule;
124 }
________________________________________________________________________________________________________
*** CID 1249787: Dereference null return value (NULL_RETURNS)
/server/src/com/cloud/network/router/VpcNetworkHelperImpl.java: 91 in
com.cloud.network.router.VpcNetworkHelperImpl.createRouterNetworks(org.cloud.network.router.deployment.RouterDeploymentDefinition)()
85
86 //1) allocate nic for control and source nat public ip
87 final LinkedHashMap<Network, List<? extends NicProfile>>
networks =
88
super.createRouterNetworks(vpcRouterDeploymentDefinition);
89
90
>>> CID 1249787: Dereference null return value (NULL_RETURNS)
>>> Calling a method on null object
>>> "vpcRouterDeploymentDefinition.getVpc()".
91 final Long vpcId =
vpcRouterDeploymentDefinition.getVpc().getId();
92 //2) allocate nic for private gateways if needed
93 final List<PrivateGateway> privateGateways =
vpcMgr.getVpcPrivateGateways(vpcId);
94 if (privateGateways != null && !privateGateways.isEmpty()) {
95 for (PrivateGateway privateGateway : privateGateways) {
96 NicProfile privateNic =
nicProfileHelper.createPrivateNicProfileForGateway(privateGateway);
________________________________________________________________________________________________________
*** CID 1249800: RE: Regular expressions (FB.RE_POSSIBLE_UNINTENDED_PATTERN)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java:
3614 in
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.getOsVersion()()
3608 return uuid;
3609 }
3610
3611 private void getOsVersion() {
3612 String version = Script.runSimpleBashScript("cat
/etc/redhat-release | awk '{print $7}'");
3613 if (version != null) {
>>> CID 1249800: RE: Regular expressions
>>> (FB.RE_POSSIBLE_UNINTENDED_PATTERN)
>>> "." used for regular expression
3614 String[] versions = version.split(".");
3615 if (versions.length == 2) {
3616 String major = versions[0];
3617 String minor = versions[1];
3618 try {
3619 Integer m = Integer.parseInt(major);
________________________________________________________________________________________________________
*** CID 1249801: ES: Checking String equality using == or !=
(FB.ES_COMPARING_STRINGS_WITH_EQ)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java:
221 in com.cloud.hypervisor.kvm.resource.LibvirtVMDef$FeaturesDef.toString()()
215 feaBuilder.append("<features>\n");
216 for (String feature : _features) {
217 feaBuilder.append("<" + feature + "/>\n");
218 }
219 if (hyperVEnlightenmentFeatureDef != null) {
220 String hpervF =
hyperVEnlightenmentFeatureDef.toString();
>>> CID 1249801: ES: Checking String equality using == or !=
>>> (FB.ES_COMPARING_STRINGS_WITH_EQ)
>>> Comparison of String objects using == or !=
221 if (hpervF != "") {
222 feaBuilder.append(hpervF);
223 }
224 }
225 feaBuilder.append("</features>\n");
226 return feaBuilder.toString();
________________________________________________________________________________________________________
*** CID 1249803: DLS: Dead local store (FB.DLS_DEAD_LOCAL_STORE)
/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java:
933 in
com.cloud.network.resource.NetscalerResource.execute(com.cloud.agent.api.routing.CreateLoadBalancerApplianceCommand,
int)()
927 // use the first device profile available on the SDX to
create an instance of VPX
928 device_profile[] profiles =
device_profile.get(_netscalerSdxService);
929 if (!(profiles != null && profiles.length >= 1)) {
930 new Answer(cmd, new ExecutionException("Failed to
create VPX instance on the netscaler SDX device " + _ip +
931 " as there are no admin profile to use for
creating VPX."));
932 }
>>> CID 1249803: DLS: Dead local store (FB.DLS_DEAD_LOCAL_STORE)
>>> Dead store to profileName
933 String profileName = profiles[0].get_name();
934 ns_obj.set_profile_name("ns_nsroot_profile");
935
936 // use the first VPX image of the available VPX images on
the SDX to create an instance of VPX
937 // TODO: should enable the option to choose the template
while adding the SDX device in to CloudStack
938 xen_nsvpx_image[] vpxImages =
xen_nsvpx_image.get(_netscalerSdxService);
________________________________________________________________________________________________________
*** CID 1249802: DLS: Dead local store (FB.DLS_DEAD_LOCAL_STORE)
/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java:
1924 in
com.cloud.network.router.VirtualNetworkApplianceManagerImpl.createDefaultEgressFirewallRule(java.util.List,
long)()
1918 NetworkOfferingVO offering =
_networkOfferingDao.findById(network.getNetworkOfferingId());
1919 defaultEgressPolicy = offering.getEgressDefaultPolicy();
1920
1921
1922 // construct rule when egress policy is true. In true case for
VR we default allow rule need to be added
1923 if (defaultEgressPolicy) {
>>> CID 1249802: DLS: Dead local store (FB.DLS_DEAD_LOCAL_STORE)
>>> Dead store to systemRule
1924 systemRule =
String.valueOf(FirewallRule.FirewallRuleType.System);
1925
1926 List<String> sourceCidr = new ArrayList<String>();
1927
1928 sourceCidr.add(NetUtils.ALL_CIDRS);
1929 FirewallRule rule = new FirewallRuleVO(null, null, null,
null, "all", networkId, network.getAccountId(), network.getDomainId(),
Purpose.Firewall, sourceCidr,
________________________________________________________________________________________________________
*** CID 1249796: WMI: Inefficient Map Iterator (FB.WMI_WRONG_MAP_ITERATOR)
/server/src/com/cloud/network/rules/NicPlugInOutRules.java: 97 in
com.cloud.network.rules.NicPlugInOutRules.accept(org.apache.cloudstack.network.topology.NetworkTopologyVisitor,
com.cloud.network.router.VirtualRouter)()
91 _netUsageCommands = new Commands(Command.OnError.Continue);
92 VpcDao vpcDao =
visitor.getVirtualNetworkApplianceFactory().getVpcDao();
93 VpcVO vpc = vpcDao.findById(_router.getVpcId());
94
95 // 2) Plug the nics
96 for (String vlanTag : nicsToPlug.keySet()) {
>>> CID 1249796: WMI: Inefficient Map Iterator (FB.WMI_WRONG_MAP_ITERATOR)
>>>
>>> com.cloud.network.rules.NicPlugInOutRules.accept(NetworkTopologyVisitor,
>>> VirtualRouter) makes inefficient use of keySet iterator instead of entrySet
>>> iterator
97 PublicIpAddress ip = nicsToPlug.get(vlanTag);
98 // have to plug the nic(s)
99 NicProfile defaultNic = new NicProfile();
100 if (ip.isSourceNat()) {
101 defaultNic.setDefaultNic(true);
102 }
________________________________________________________________________________________________________
*** CID 1249794: UuF: Unused field (FB.UUF_UNUSED_FIELD)
/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java:
1620 in ()
1614
1615 @SuppressWarnings("unused")
1616 private static final class RollbackInitiatedResult {
1617 private Result result;
1618
1619 private static final class Result {
>>> CID 1249794: UuF: Unused field (FB.UUF_UNUSED_FIELD)
>>> Unused field:
>>> org.apache.cloudstack.storage.datastore.util.SolidFireUtil$RollbackInitiatedResult$Result.snapshotID
1620 private long snapshotID;
1621 }
1622 }
1623
1624 private static final class CloneCreateResult {
1625 private Result result;
________________________________________________________________________________________________________
*** CID 1249798: SIC: Inner class could be made static
(FB.SIC_INNER_SHOULD_BE_STATIC)
/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinitionBuilder.java:
154 in ()
148 routerDeploymentDefinition.vpcMgr = vpcMgr;
149 routerDeploymentDefinition.vlanDao = vlanDao;
150 routerDeploymentDefinition.nwHelper = vpcNwHelper;
151 routerDeploymentDefinition.routerDao = routerDao;
152 }
153
>>> CID 1249798: SIC: Inner class could be made static
>>> (FB.SIC_INNER_SHOULD_BE_STATIC)
>>> Should
>>> org.cloud.network.router.deployment.RouterDeploymentDefinitionBuilder$IntermediateStateBuilder
>>> be a _static_ inner class?
154 public class IntermediateStateBuilder {
155
156 RouterDeploymentDefinitionBuilder builder;
157
158 protected Vpc vpc;
159 protected Network guestNetwork;
________________________________________________________________________________________________________
*** CID 1249797: UrF: Unread field (FB.URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD)
/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinitionBuilder.java:
164 in ()
158 protected Vpc vpc;
159 protected Network guestNetwork;
160 protected DeployDestination dest;
161 protected Account owner;
162 protected Map<Param, Object> params;
163 protected boolean isRedundant;
>>> CID 1249797: UrF: Unread field
>>> (FB.URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD)
>>> Unread public/protected field:
>>> org.cloud.network.router.deployment.RouterDeploymentDefinitionBuilder$IntermediateStateBuilder.routers
164 protected List<DomainRouterVO> routers = new ArrayList<>();
165
166 protected IntermediateStateBuilder(final
RouterDeploymentDefinitionBuilder builder) {
167 this.builder = builder;
168 }
169
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit,
http://scan.coverity.com/projects/943?tab=overview
To unsubscribe from the email notification for new defects,
http://scan5.coverity.com/cgi-bin/unsubscribe.py