Hi,
Please find the latest report on new defect(s) introduced to cloudstack found
with Coverity Scan.
5 new defect(s) introduced to cloudstack found with Coverity Scan.
2 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 5 of 5 defect(s)
** CID 1258460: RC: Questionable use of reference equality rather than calling
equals (FB.RC_REF_COMPARISON)
/server/src/com/cloud/network/rules/RulesManagerImpl.java: 1530 in
com.cloud.network.rules.RulesManagerImpl.updatePortForwardingRule(long,
java.lang.Integer, java.lang.Long, com.cloud.utils.net.Ip, java.lang.String,
java.lang.Boolean)()
** CID 1258459: UPM: Private method is never called
(FB.UPM_UNCALLED_PRIVATE_METHOD)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2672 in
com.cloud.storage.VolumeApiServiceImpl.orchestrateExtractVolume(com.cloud.vm.VmWorkExtractVolume)()
** CID 1258458: UrF: Unread field (FB.URF_UNREAD_FIELD)
/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java: 70 in ()
/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java: 78 in ()
/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java: 74 in ()
** CID 1258457: Dereference after null check (FORWARD_NULL)
/server/src/com/cloud/server/ManagementServerImpl.java: 3614 in
com.cloud.server.ManagementServerImpl.registerSSHKeyPair(org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd)()
** CID 1258456: Dereference null return value (NULL_RETURNS)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2127 in
com.cloud.storage.VolumeApiServiceImpl.orchestrateExtractVolume(long, long)()
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2102 in
com.cloud.storage.VolumeApiServiceImpl.orchestrateExtractVolume(long, long)()
________________________________________________________________________________________________________
*** CID 1258460: RC: Questionable use of reference equality rather than
calling equals (FB.RC_REF_COMPARISON)
/server/src/com/cloud/network/rules/RulesManagerImpl.java: 1530 in
com.cloud.network.rules.RulesManagerImpl.updatePortForwardingRule(long,
java.lang.Integer, java.lang.Long, com.cloud.utils.net.Ip, java.lang.String,
java.lang.Boolean)()
1524 }
1525
1526 if (forDisplay != null) {
1527 rule.setDisplay(forDisplay);
1528 }
1529
>>> CID 1258460: RC: Questionable use of reference equality rather than
>>> calling equals (FB.RC_REF_COMPARISON)
>>> Suspicious comparison of Integer references
1530 if (rule.getSourcePortStart() != rule.getSourcePortEnd() &&
privatePort != null) {
1531 throw new InvalidParameterValueException("Unable to update
the private port of port forwarding rule as the rule has port range : " +
rule.getSourcePortStart() + " to " + rule.getSourcePortEnd());
1532 }
1533 if (virtualMachineId == null && vmGuestIp != null) {
1534 throw new InvalidParameterValueException("vmguestip should
be set along with virtualmachineid");
1535 }
________________________________________________________________________________________________________
*** CID 1258459: UPM: Private method is never called
(FB.UPM_UNCALLED_PRIVATE_METHOD)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2672 in
com.cloud.storage.VolumeApiServiceImpl.orchestrateExtractVolume(com.cloud.vm.VmWorkExtractVolume)()
2666
AsyncJobExecutionContext.getCurrentExecutionContext().joinJob(workJob.getId());
2667
2668 return new VmJobSnapshotOutcome(workJob,snapshotId);
2669 }
2670
2671 @ReflectionUse
>>> CID 1258459: UPM: Private method is never called
>>> (FB.UPM_UNCALLED_PRIVATE_METHOD)
>>> Private method
>>> com.cloud.storage.VolumeApiServiceImpl.orchestrateExtractVolume(VmWorkExtractVolume)
>>> is never called
2672 private Pair<JobInfo.Status, String>
orchestrateExtractVolume(VmWorkExtractVolume work) throws Exception {
2673 String volUrl = orchestrateExtractVolume(work.getVolumeId(),
work.getZoneId());
2674 return new Pair<JobInfo.Status,
String>(JobInfo.Status.SUCCEEDED, _jobMgr.marshallResultObject(volUrl));
2675 }
2676
2677 @ReflectionUse
________________________________________________________________________________________________________
*** CID 1258458: UrF: Unread field (FB.URF_UNREAD_FIELD)
/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java: 70 in ()
64
65 public void setFingerprint(String fingerprint) {
66 this.fingerprint = fingerprint;
67 }
68
69 public void setAccountName(String accountName) {
>>> CID 1258458: UrF: Unread field (FB.URF_UNREAD_FIELD)
>>> Unread field:
>>> org.apache.cloudstack.api.response.SSHKeyPairResponse.accountName
70 this.accountName = accountName;
71 }
72
73 public void setDomainId(String domainId) {
74 this.domainId = domainId;
75 }
/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java: 78 in ()
72
73 public void setDomainId(String domainId) {
74 this.domainId = domainId;
75 }
76
77 public void setDomainName(String domain) {
>>> CID 1258458: UrF: Unread field (FB.URF_UNREAD_FIELD)
>>> Unread field:
>>> org.apache.cloudstack.api.response.SSHKeyPairResponse.domain
78 this.domain = domain;
79 }
/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java: 74 in ()
68
69 public void setAccountName(String accountName) {
70 this.accountName = accountName;
71 }
72
73 public void setDomainId(String domainId) {
>>> CID 1258458: UrF: Unread field (FB.URF_UNREAD_FIELD)
>>> Unread field:
>>> org.apache.cloudstack.api.response.SSHKeyPairResponse.domainId
74 this.domainId = domainId;
75 }
76
77 public void setDomainName(String domain) {
78 this.domain = domain;
79 }
________________________________________________________________________________________________________
*** CID 1258457: Dereference after null check (FORWARD_NULL)
/server/src/com/cloud/server/ManagementServerImpl.java: 3614 in
com.cloud.server.ManagementServerImpl.registerSSHKeyPair(org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd)()
3608 throw new InvalidParameterValueException("A key pair with
name '" + cmd.getName() + "' already exists.");
3609 }
3610
3611 String name = cmd.getName();
3612 String key = cmd.getPublicKey();
3613 try {
>>> CID 1258457: Dereference after null check (FORWARD_NULL)
>>> Comparing "key" to null implies that "key" might be null.
3614 if (key != null) {
3615 key = URLDecoder.decode(key, "UTF-8");
3616 }
3617 } catch (UnsupportedEncodingException e) {
3618 } finally {
3619 }
________________________________________________________________________________________________________
*** CID 1258456: Dereference null return value (NULL_RETURNS)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2127 in
com.cloud.storage.VolumeApiServiceImpl.orchestrateExtractVolume(long, long)()
2121 String errorString = "Failed to copy the volume from the
source primary storage pool to secondary storage.";
2122 throw new CloudRuntimeException(errorString);
2123 }
2124
2125 VolumeInfo vol = cvResult.getVolume();
2126
>>> CID 1258456: Dereference null return value (NULL_RETURNS)
>>> Calling a method on null object "secStore".
2127 String extractUrl =
secStore.createEntityExtractUrl(vol.getPath(), vol.getFormat(), vol);
2128 VolumeDataStoreVO volumeStoreRef =
_volumeStoreDao.findByVolume(volumeId);
2129 volumeStoreRef.setExtractUrl(extractUrl);
2130 volumeStoreRef.setExtractUrlCreated(DateUtil.now());
2131 _volumeStoreDao.update(volumeStoreRef.getId(), volumeStoreRef);
2132 return extractUrl;
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2102 in
com.cloud.storage.VolumeApiServiceImpl.orchestrateExtractVolume(long, long)()
2096 // get latest volume state to make sure that it is not updated
by other parallel operations
2097 VolumeVO volume = _volsDao.findById(volumeId);
2098 if (volume == null || volume.getState() != Volume.State.Ready)
{
2099 throw new InvalidParameterValueException("Volume to be
extracted has been removed or not in right state!");
2100 }
2101 // perform extraction
>>> CID 1258456: Dereference null return value (NULL_RETURNS)
>>> Assigning: "secStore" = null return value from
>>> "org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager.getImageStore(long)".
2102 ImageStoreEntity secStore =
(ImageStoreEntity)dataStoreMgr.getImageStore(zoneId);
2103 String value =
_configDao.getValue(Config.CopyVolumeWait.toString());
2104 NumbersUtil.parseInt(value,
Integer.parseInt(Config.CopyVolumeWait.getDefaultValue()));
2105
2106 // Copy volume from primary to secondary storage
2107 VolumeInfo srcVol = volFactory.getVolume(volumeId);
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit,
http://scan.coverity.com/projects/943?tab=overview
To manage Coverity Scan email notifications for "[email protected]",
click
http://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.org&token=494aabd5ba647999fa41b6d766646231
.