Hi,
Please find the latest report on new defect(s) introduced to cloudstack found
with Coverity Scan.
6 new defect(s) introduced to cloudstack found with Coverity Scan.
17 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 6 of 6 defect(s)
** CID 1261671: Dereference after null check (FORWARD_NULL)
/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java: 150 in
com.cloud.domain.dao.DomainDaoImpl.remove(java.lang.Long)()
** CID 1261670: Dereference after null check (FORWARD_NULL)
/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java:
193 in
org.apache.cloudstack.storage.motion.AncientDataMotionStrategy.copyObject(org.apache.cloudstack.engine.subsystem.api.storage.DataObject,
org.apache.cloudstack.engine.subsystem.api.storage.DataObject,
com.cloud.host.Host)()
** CID 1261669: Dereference after null check (FORWARD_NULL)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
4247 in
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getHostInfo(com.xensource.xenapi.Connection)()
** CID 1261667: Dereference null return value (NULL_RETURNS)
** CID 1261668: Dereference null return value (NULL_RETURNS)
** CID 1261666: Dereference null return value (NULL_RETURNS)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java:
164 in
com.cloud.hypervisor.xenserver.discoverer.XcpServerDiscoverer.poolHasHotFix(com.xensource.xenapi.Connection,
java.lang.String, java.lang.String)()
________________________________________________________________________________________________________
*** CID 1261671: Dereference after null check (FORWARD_NULL)
/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java: 150 in
com.cloud.domain.dao.DomainDaoImpl.remove(java.lang.Long)()
144 }
145
146 @Override
147 @DB
148 public boolean remove(Long id) {
149 // check for any active users / domains assigned to the given
domain id and don't remove the domain if there are any
>>> CID 1261671: Dereference after null check (FORWARD_NULL)
>>> Comparing "id" to null implies that "id" might be null.
150 if (id != null && id.longValue() == Domain.ROOT_DOMAIN) {
151 s_logger.error("Can not remove domain " + id + " as it is
ROOT domain");
152 return false;
153 }
154
155 DomainVO domain = findById(id);
________________________________________________________________________________________________________
*** CID 1261670: Dereference after null check (FORWARD_NULL)
/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java:
193 in
org.apache.cloudstack.storage.motion.AncientDataMotionStrategy.copyObject(org.apache.cloudstack.engine.subsystem.api.storage.DataObject,
org.apache.cloudstack.engine.subsystem.api.storage.DataObject,
com.cloud.host.Host)()
187 ", uuid: " + cacheUuid + ")");
188 cacheMgr.deleteCacheObject(srcForCopy);
189 } else {
190 // for template, we want to leave it on cache for
performance reason
191 if ((answer == null || !answer.getResult()) &&
srcForCopy.getRefCount() < 2) {
192 // cache object created by this copy, not
already there
>>> CID 1261670: Dereference after null check (FORWARD_NULL)
>>> Calling a method on null object "ep".
193 s_logger.warn("Copy may not be handled
correctly by agent(id: " + ep.getId() + ")." +
194 " Delete " + cacheType + "
cache(id: " + cacheId +
195 ", uuid: " + cacheUuid + ")");
196 cacheMgr.deleteCacheObject(srcForCopy);
197 } else {
198 s_logger.debug("Decrease reference count of " +
cacheType +
________________________________________________________________________________________________________
*** CID 1261669: Dereference after null check (FORWARD_NULL)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
4247 in
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getHostInfo(com.xensource.xenapi.Connection)()
4241 throw new CloudRuntimeException("Cannot get the
numbers of cpu from XenServer host " + _host.ip);
4242 }
4243 Map<String, String> cpuInfo = myself.getCpuInfo(conn);
4244 if (cpuInfo.get("socket_count") != null) {
4245 _host.cpuSockets =
Integer.parseInt(cpuInfo.get("socket_count"));
4246 }
>>> CID 1261669: Dereference after null check (FORWARD_NULL)
>>> Calling a method on null object "hcs".
4247 for (final HostCpu hc : hcs) {
4248 _host.speed = hc.getSpeed(conn).intValue();
4249 break;
4250 }
4251 Host.Record hr = myself.getRecord(conn);
4252 _host.productVersion = CitrixHelper.getProductVersion(hr);
________________________________________________________________________________________________________
*** CID 1261667: Dereference null return value (NULL_RETURNS)
/api/src/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java:
126 in
org.apache.cloudstack.api.command.user.vm.RemoveIpFromVmNicCmd.getNetworkType()()
120 } else {
121 return null;
122 }
123 }
124
125 public NetworkType getNetworkType() {
>>> CID 1261667: Dereference null return value (NULL_RETURNS)
>>> Dereferencing a pointer that might be null "getNetworkId()" when
>>> calling "com.cloud.utils.db.EntityManager.findById(java.lang.Class,
>>> java.io.Serializable)". (The virtual call resolves to
>>> "com.cloud.dao.EntityManagerImpl.findById(java.lang.Class,
>>> java.io.Serializable)".)
126 Network ntwk = _entityMgr.findById(Network.class,
getNetworkId());
127 if (ntwk != null) {
128 DataCenter dc = _entityMgr.findById(DataCenter.class,
ntwk.getDataCenterId());
129 return dc.getNetworkType();
130 }
131 return null;
________________________________________________________________________________________________________
*** CID 1261668: Dereference null return value (NULL_RETURNS)
/api/src/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java:
136 in
org.apache.cloudstack.api.command.user.vm.RemoveIpFromVmNicCmd.isZoneSGEnabled()()
130 }
131 return null;
132 }
133
134
135 private boolean isZoneSGEnabled() {
>>> CID 1261668: Dereference null return value (NULL_RETURNS)
>>> Dereferencing a pointer that might be null "getNetworkId()" when
>>> calling "com.cloud.utils.db.EntityManager.findById(java.lang.Class,
>>> java.io.Serializable)". (The virtual call resolves to
>>> "com.cloud.dao.EntityManagerImpl.findById(java.lang.Class,
>>> java.io.Serializable)".)
136 Network ntwk = _entityMgr.findById(Network.class,
getNetworkId());
137 DataCenter dc = _entityMgr.findById(DataCenter.class,
ntwk.getDataCenterId());
138 return dc.isSecurityGroupEnabled();
139 }
140
141 @Override
________________________________________________________________________________________________________
*** CID 1261666: Dereference null return value (NULL_RETURNS)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java:
164 in
com.cloud.hypervisor.xenserver.discoverer.XcpServerDiscoverer.poolHasHotFix(com.xensource.xenapi.Connection,
java.lang.String, java.lang.String)()
158 continue;
159 }
160 Set<HostPatch> patches = re.patches;
161 PoolPatch poolPatch = PoolPatch.getByUuid(conn,
hotFixUuid);
162 for(HostPatch patch : patches) {
163 PoolPatch pp = patch.getPoolPatch(conn);
>>> CID 1261666: Dereference null return value (NULL_RETURNS)
>>> Calling a method on null object "pp".
164 if (pp.equals(poolPatch) && patch.getApplied(conn))
{
165 s_logger.debug("host " + hostIp + " does have "
+ hotFixUuid +" Hotfix.");
166 return true;
167 }
168 }
169 }
________________________________________________________________________________________________________
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
.