cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Animesh Chaturvedi <animesh.chaturv...@citrix.com>
Subject FW: New Defects reported by Coverity Scan for cloudstack
Date Tue, 10 Jun 2014 04:07:32 GMT
Folks please check on the issues reported.

> -----Original Message-----
> From: scan-admin@coverity.com [mailto:scan-admin@coverity.com]
> Sent: Monday, June 09, 2014 7:37 PM
> Subject: New Defects reported by Coverity Scan for cloudstack
> 
> 
> Hi,
> 
> 
> Please find the latest report on new defect(s) introduced to cloudstack
> found with Coverity Scan.
> 
> Defect(s) Reported-by: Coverity Scan
> Showing 20 of 67 defect(s)
> 
> 
> ** CID 1222156:  Value not atomically updated  (ATOMICITY)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 5272 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.execute(com.cl
> oud.agent.api.OvsDestroyBridgeCommand)()
> 
> ** CID 1222157:  Dereference after null check  (FORWARD_NULL)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 1097 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getNetwork(co
> m.xensource.xenapi.Connection, com.cloud.agent.api.to.NicTO)()
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 1088 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getNetwork(co
> m.xensource.xenapi.Connection, com.cloud.agent.api.to.NicTO)()
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 1088 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getNetwork(co
> m.xensource.xenapi.Connection, com.cloud.agent.api.to.NicTO)()
> 
> ** CID 1222175:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 3025 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.execute(com.cl
> oud.agent.api.MigrateCommand)()
> 
> ** CID 1222174:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 6347 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.execute(com.cl
> oud.agent.api.AttachVolumeCommand)()
> 
> ** CID 1222173:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 6285 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.execute(com.cl
> oud.agent.api.AttachVolumeCommand)()
> 
> ** CID 1222172:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 7200 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.clusterVMMet
> aDataSync(com.xensource.xenapi.Connection)()
> 
> ** CID 1222171:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 6131 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getNfsSR(com.
> xensource.xenapi.Connection, com.cloud.agent.api.to.StorageFilerTO)()
> 
> ** CID 1222170:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 6412 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getVMSnapsh
> otChainSize(com.xensource.xenapi.Connection,
> org.apache.cloudstack.storage.to.VolumeObjectTO, java.lang.String)()
> 
> ** CID 1222169:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 6098 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getIscsiSR(com
> .xensource.xenapi.Connection, java.lang.String, java.lang.String,
> java.lang.String, java.lang.String, java.lang.String, boolean)()
> 
> ** CID 1222168:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 1944 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.prepareManag
> edStorage(com.xensource.xenapi.Connection, java.util.Map, java.lang.String,
> java.lang.String)()
> 
> ** CID 1222167:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 7519 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.prepareNetwo
> rkElementCommand(com.cloud.agent.api.routing.SetNetworkACLCommand
> )()
> 
> ** CID 1222166:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 7499 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.prepareNetwo
> rkElementCommand(com.cloud.agent.api.routing.SetSourceNatCommand)()
> 
> ** CID 1222165:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 4166 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.enableVlanNet
> work(com.xensource.xenapi.Connection, long,
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase$XsLocalNetwo
> rk)()
> 
> ** CID 1222164:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 937 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.enableXenServ
> erNetwork(com.xensource.xenapi.Connection,
> com.xensource.xenapi.Network, java.lang.String, java.lang.String)()
> 
> ** CID 1222163:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 1174 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.createVif(com.
> xensource.xenapi.Connection, java.lang.String, com.xensource.xenapi.VM,
> com.cloud.agent.api.to.VirtualMachineTO, com.cloud.agent.api.to.NicTO)()
> 
> ** CID 1222162:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/disco
> verer/XcpServerDiscoverer.java: 153 in
> com.cloud.hypervisor.xenserver.discoverer.XcpServerDiscoverer.poolHasHo
> tFix(com.xensource.xenapi.Connection, java.lang.String, java.lang.String)()
> 
> ** CID 1222161:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/XenServer620SP1Resource.java: 115 in
> com.cloud.hypervisor.xenserver.resource.XenServer620SP1Resource.getGP
> UGroupDetails(com.xensource.xenapi.Connection)()
> 
> ** CID 1222160:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/XenServer620SP1Resource.java: 117 in
> com.cloud.hypervisor.xenserver.resource.XenServer620SP1Resource.getGP
> UGroupDetails(com.xensource.xenapi.Connection)()
> 
> ** CID 1222159:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/XenServer620SP1Resource.java: 143 in
> com.cloud.hypervisor.xenserver.resource.XenServer620SP1Resource.create
> VGPU(com.xensource.xenapi.Connection,
> com.cloud.agent.api.StartCommand, com.xensource.xenapi.VM,
> com.cloud.agent.api.to.GPUDeviceTO)()
> 
> ** CID 1222158:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/XenServer620Resource.java: 84 in
> com.cloud.hypervisor.xenserver.resource.XenServer620Resource.hostHasH
> otFix(com.xensource.xenapi.Connection, java.lang.String)()
> 
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222156:  Value not atomically updated  (ATOMICITY)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 5272 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.execute(com.cl
> oud.agent.api.OvsDestroyBridgeCommand)()
> 5266
> 5267         private Answer execute(OvsDestroyBridgeCommand cmd) {
> 5268             try {
> 5269                 Connection conn = getConnection();
> 5270                 Network nw = findOrCreateTunnelNetwork(conn,
> cmd.getBridgeName());
> 5271                 cleanUpTmpDomVif(conn, nw);
> >>>     CID 1222156:  Value not atomically updated  (ATOMICITY)
> >>>     Using "nw", an unreliable value, inside a synchronous method
> ("destroyTunnelNetwork(conn, nw, cmd.getHostId())"). This code might not
> be thread safe or might indicate a source of unnecessary synchronization.
> 5272                 destroyTunnelNetwork(conn, nw, cmd.getHostId());
> 5273                 s_logger.debug("OVS Bridge destroyed");
> 5274                 return new Answer(cmd, true, null);
> 5275             } catch (Exception e) {
> 5276                 s_logger.warn("caught execption when destroying ovs
> bridge", e);
> 5277                 return new Answer(cmd, false, e.getMessage());
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222157:  Dereference after null check  (FORWARD_NULL)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 1097 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getNetwork(co
> m.xensource.xenapi.Connection, com.cloud.agent.api.to.NicTO)()
> 1091                 assert (BroadcastDomainType.getSchemeValue(uri) ==
> BroadcastDomainType.Vlan);
> 1092                 long vlan =
> Long.parseLong(BroadcastDomainType.getValue(uri));
> 1093                 return enableVlanNetwork(conn, vlan, network);
> 1094             } else if (type == BroadcastDomainType.Native || type ==
> BroadcastDomainType.LinkLocal) {
> 1095                 return network.getNetwork();
> 1096             } else if (type == BroadcastDomainType.Vswitch) {
> >>>     CID 1222157:  Dereference after null check  (FORWARD_NULL)
> >>>     Calling a method on null object "uri".
> 1097                 String header =
> uri.toString().substring(Networks.BroadcastDomainType.Vswitch.scheme().l
> ength() + "://".length());
> 1098                 if (header.startsWith("vlan")) {
> 1099                     _isOvs = true;
> 1100                     return setupvSwitchNetwork(conn);
> 1101                 } else {
> 1102                     return findOrCreateTunnelNetwork(conn,
> getOvsTunnelNetworkName(uri.getAuthority()));
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 1088 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getNetwork(co
> m.xensource.xenapi.Connection, com.cloud.agent.api.to.NicTO)()
> 1082             if (network == null) {
> 1083                 s_logger.error("Network is not configured on the backend
> for nic " + nic.toString());
> 1084                 throw new CloudRuntimeException("Network for the
> backend is not configured correctly for network broadcast domain: " +
> nic.getBroadcastUri());
> 1085             }
> 1086             URI uri = nic.getBroadcastUri();
> 1087             BroadcastDomainType type = nic.getBroadcastType();
> >>>     CID 1222157:  Dereference after null check  (FORWARD_NULL)
> >>>     Comparing "uri" to null implies that "uri" might be null.
> 1088             if (uri != null && uri.toString().contains("untagged")) {
> 1089                 return network.getNetwork();
> 1090             } else if (type == BroadcastDomainType.Vlan) {
> 1091                 assert (BroadcastDomainType.getSchemeValue(uri) ==
> BroadcastDomainType.Vlan);
> 1092                 long vlan =
> Long.parseLong(BroadcastDomainType.getValue(uri));
> 1093                 return enableVlanNetwork(conn, vlan, network);
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 1088 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getNetwork(co
> m.xensource.xenapi.Connection, com.cloud.agent.api.to.NicTO)()
> 1082             if (network == null) {
> 1083                 s_logger.error("Network is not configured on the backend
> for nic " + nic.toString());
> 1084                 throw new CloudRuntimeException("Network for the
> backend is not configured correctly for network broadcast domain: " +
> nic.getBroadcastUri());
> 1085             }
> 1086             URI uri = nic.getBroadcastUri();
> 1087             BroadcastDomainType type = nic.getBroadcastType();
> >>>     CID 1222157:  Dereference after null check  (FORWARD_NULL)
> >>>     Comparing "uri" to null implies that "uri" might be null.
> 1088             if (uri != null && uri.toString().contains("untagged")) {
> 1089                 return network.getNetwork();
> 1090             } else if (type == BroadcastDomainType.Vlan) {
> 1091                 assert (BroadcastDomainType.getSchemeValue(uri) ==
> BroadcastDomainType.Vlan);
> 1092                 long vlan =
> Long.parseLong(BroadcastDomainType.getValue(uri));
> 1093                 return enableVlanNetwork(conn, vlan, network);
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222175:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 3025 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.execute(com.cl
> oud.agent.api.MigrateCommand)()
> 3019                 Set<VM> vms = VM.getByNameLabel(conn, vmName);
> 3020
> 3021                 String ipaddr = cmd.getDestinationIp();
> 3022
> 3023                 Set<Host> hosts = Host.getAll(conn);
> 3024                 Host dsthost = null;
> >>>     CID 1222175:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "hosts".
> 3025                 for (Host host : hosts) {
> 3026                     if (host.getAddress(conn).equals(ipaddr)) {
> 3027                         dsthost = host;
> 3028                         break;
> 3029                     }
> 3030                 }
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222174:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 6347 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.execute(com.cl
> oud.agent.api.AttachVolumeCommand)()
> 6341                     VBD vbd = VBD.create(conn, vbdr);
> 6342
> 6343                     // Attach the VBD to the VM
> 6344                     vbd.plug(conn);
> 6345
> 6346                     // Update the VDI's label to include the VM name
> >>>     CID 1222174:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "vdi".
> 6347                     vdi.setNameLabel(conn, vdiNameLabel);
> 6348
> 6349                     return new AttachVolumeAnswer(cmd,
> Long.parseLong(diskNumber), vdi.getUuid(conn));
> 6350                 } else {
> 6351                     // Look up all VBDs for this VDI
> 6352                     Set<VBD> vbds = vdi.getVBDs(conn);
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222173:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 6285 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.execute(com.cl
> oud.agent.api.AttachVolumeCommand)()
> 6279             }
> 6280
> 6281             try {
> 6282                 VDI vdi = null;
> 6283
> 6284                 if (cmd.getAttach() && cmd.isManaged()) {
> >>>     CID 1222173:  Dereference null return value  (NULL_RETURNS)
> >>>     Assigning: "sr" = null return value from
> "com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getIscsiSR(co
> m.xensource.xenapi.Connection, java.lang.String, java.lang.String,
> java.lang.String, java.lang.String, java.lang.String, boolean)".
> 6285                     SR sr =
> 6286                             getIscsiSR(conn, cmd.get_iScsiName(),
> cmd.getStorageHost(), cmd.get_iScsiName(),
> cmd.getChapInitiatorUsername(), cmd.getChapInitiatorPassword(), true);
> 6287
> 6288                     vdi = getVDIbyUuid(conn, cmd.getVolumePath(), false);
> 6289
> 6290                     if (vdi == null) {
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222172:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 7200 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.clusterVMMet
> aDataSync(com.xensource.xenapi.Connection)()
> 7194         }
> 7195
> 7196         protected HashMap<String, String>
> clusterVMMetaDataSync(Connection conn) {
> 7197             final HashMap<String, String> vmMetaDatum = new
> HashMap<String, String>();
> 7198             try {
> 7199                 Map<VM, VM.Record>  vm_map = VM.getAllRecords(conn);
> //USE THIS TO GET ALL VMS FROM  A CLUSTER
> >>>     CID 1222172:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "vm_map".
> 7200                 for (VM.Record record: vm_map.values()) {
> 7201                     if (record.isControlDomain || record.isASnapshot ||
> record.isATemplate) {
> 7202                         continue; // Skip DOM0
> 7203                     }
> 7204                     vmMetaDatum.put(record.nameLabel,
> StringUtils.mapToString(record.platform));
> 7205                 }
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222171:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 6131 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getNfsSR(com.
> xensource.xenapi.Connection, com.cloud.agent.api.to.StorageFilerTO)()
> 6125             Map<String, String> deviceConfig = new HashMap<String,
> String>();
> 6126             try {
> 6127                 String server = pool.getHost();
> 6128                 String serverpath = pool.getPath();
> 6129                 serverpath = serverpath.replace("//", "/");
> 6130                 Set<SR> srs = SR.getAll(conn);
> >>>     CID 1222171:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "srs".
> 6131                 for (SR sr : srs) {
> 6132                     if (!SRType.NFS.equals(sr.getType(conn))) {
> 6133                         continue;
> 6134                     }
> 6135
> 6136                     Set<PBD> pbds = sr.getPBDs(conn);
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222170:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 6412 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getVMSnapsh
> otChainSize(com.xensource.xenapi.Connection,
> org.apache.cloudstack.storage.to.VolumeObjectTO, java.lang.String)()
> 6406                     continue;
> 6407                 }
> 6408             }
> 6409             if (volumeTo.getVolumeType() == Volume.Type.ROOT) {
> 6410                 Map<VM, VM.Record> allVMs = VM.getAllRecords(conn);
> 6411                 // add size of memory snapshot vdi
> >>>     CID 1222170:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "allVMs".
> 6412                 if (allVMs.size() > 0) {
> 6413                     for (VM vmr : allVMs.keySet()) {
> 6414                         try {
> 6415                             String vName = vmr.getNameLabel(conn);
> 6416                             if (vName != null && vName.contains(vmName)
&&
> vmr.getIsASnapshot(conn)) {
> 6417
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222169:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 6098 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getIscsiSR(com
> .xensource.xenapi.Connection, java.lang.String, java.lang.String,
> java.lang.String, java.lang.String, java.lang.String, boolean)()
> 6092
> 6093                             throw ex;
> 6094                         }
> 6095
> 6096                         Set<Host> setHosts = Host.getAll(conn);
> 6097
> >>>     CID 1222169:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "setHosts".
> 6098                         for (Host currentHost : setHosts) {
> 6099                             PBD.Record rec = new PBD.Record();
> 6100
> 6101                             rec.deviceConfig = deviceConfig;
> 6102                             rec.host = currentHost;
> 6103                             rec.SR = sr;
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222168:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 1944 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.prepareManag
> edStorage(com.xensource.xenapi.Connection, java.util.Map, java.lang.String,
> java.lang.String)()
> 1938             String chapInitiatorSecret =
> details.get(DiskTO.CHAP_INITIATOR_SECRET);
> 1939
> 1940             return getIscsiSR(conn, iScsiName, storageHost, iScsiName,
> chapInitiatorUsername, chapInitiatorSecret, true);
> 1941         }
> 1942
> 1943         protected VDI prepareManagedStorage(Connection conn,
> Map<String, String> details, String path, String vdiNameLabel) throws
> Exception {
> >>>     CID 1222168:  Dereference null return value  (NULL_RETURNS)
> >>>     Assigning: "sr" = null return value from
> "com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.prepareMana
> gedSr(com.xensource.xenapi.Connection, java.util.Map)".
> 1944             SR sr = prepareManagedSr(conn, details);
> 1945
> 1946             VDI vdi = getVDIbyUuid(conn, path, false);
> 1947
> 1948             if (vdi == null) {
> 1949                 Long volumeSize =
> Long.parseLong(details.get(DiskTO.VOLUME_SIZE));
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222167:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 7519 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.prepareNetwo
> rkElementCommand(com.cloud.agent.api.routing.SetNetworkACLCommand
> )()
> 7513             try {
> 7514                 VM router = getVM(conn, routerName);
> 7515
> 7516                 NicTO nic = cmd.getNic();
> 7517                 VIF vif = getVifByMac(conn, router, nic.getMac());
> 7518
> >>>     CID 1222167:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "vif".
> 7519                 nic.setDeviceId(Integer.valueOf(vif.getDevice(conn)));
> 7520             } catch (Exception e) {
> 7521                 String msg = "Prepare SetNetworkACL failed due to " +
> e.toString();
> 7522                 s_logger.error(msg, e);
> 7523                 return new ExecutionResult(false, msg);
> 7524             }
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222166:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 7499 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.prepareNetwo
> rkElementCommand(com.cloud.agent.api.routing.SetSourceNatCommand)()
> 7493             IpAddressTO pubIp = cmd.getIpAddress();
> 7494             try {
> 7495                 VM router = getVM(conn, routerName);
> 7496
> 7497                 VIF correctVif = getCorrectVif(conn, router, pubIp);
> 7498
> >>>     CID 1222166:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "correctVif".
> 7499
> pubIp.setNicDevId(Integer.valueOf(correctVif.getDevice(conn)));
> 7500
> 7501             } catch (Exception e) {
> 7502                 String msg = "Ip SNAT failure due to " + e.toString();
> 7503                 s_logger.error(msg, e);
> 7504                 return new ExecutionResult(false, msg);
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222165:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 4166 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.enableVlanNet
> work(com.xensource.xenapi.Connection, long,
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase$XsLocalNetwo
> rk)()
> 4160                 vlanNic = getNetworkByName(conn, newName);
> 4161             }
> 4162
> 4163             PIF nPif = network.getPif(conn);
> 4164             PIF.Record nPifr = network.getPifRecord(conn);
> 4165
> >>>     CID 1222165:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "vlanNic".
> 4166             vlanNetwork = vlanNic.getNetwork();
> 4167             if (vlanNic.getPif(conn) != null) {
> 4168                 return vlanNetwork;
> 4169             }
> 4170
> 4171             if (s_logger.isDebugEnabled()) {
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222164:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 937 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.enableXenServ
> erNetwork(com.xensource.xenapi.Connection,
> com.xensource.xenapi.Network, java.lang.String, java.lang.String)()
> 931                 vifr.lockingMode =
> Types.VifLockingMode.NETWORK_DEFAULT;
> 932                 dom0vif = VIF.create(conn, vifr);
> 933                 synchronized (_tmpDom0Vif) {
> 934                     _tmpDom0Vif.add(dom0vif);
> 935                 }
> 936                 try {
> >>>     CID 1222164:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "dom0vif".
> 937                     dom0vif.plug(conn);
> 938                 } catch (Exception e) {
> 939                     // though an exception is thrown here, VIF actually gets
> plugged-in to dom0, so just ignore the exception
> 940                 }
> 941                 dom0vif.unplug(conn);
> 942             }
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222163:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/CitrixResourceBase.java: 1174 in
> com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.createVif(com.
> xensource.xenapi.Connection, java.lang.String, com.xensource.xenapi.VM,
> com.cloud.agent.api.to.VirtualMachineTO, com.cloud.agent.api.to.NicTO)()
> 1168                 vifr.qosAlgorithmParams.put("kbps",
> Integer.toString(nic.getNetworkRateMbps() * 128));
> 1169             }
> 1170
> 1171             vifr.lockingMode = Types.VifLockingMode.NETWORK_DEFAULT;
> 1172             VIF vif = VIF.create(conn, vifr);
> 1173             if (s_logger.isDebugEnabled()) {
> >>>     CID 1222163:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "vif".
> 1174                 vifr = vif.getRecord(conn);
> 1175                 s_logger.debug("Created a vif " + vifr.uuid + " on " +
> nic.getDeviceId());
> 1176             }
> 1177
> 1178             return vif;
> 1179         }
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222162:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/disco
> verer/XcpServerDiscoverer.java: 153 in
> com.cloud.hypervisor.xenserver.discoverer.XcpServerDiscoverer.poolHasHo
> tFix(com.xensource.xenapi.Connection, java.lang.String, java.lang.String)()
> 147             }
> 148         }
> 149
> 150         protected boolean poolHasHotFix(Connection conn, String hostIp,
> String hotFixUuid) {
> 151             try {
> 152                 Map<Host, Host.Record> hosts = Host.getAllRecords(conn);
> >>>     CID 1222162:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "hosts".
> 153                 for (Map.Entry<Host, Host.Record> entry : hosts.entrySet())
{
> 154
> 155                     Host.Record re = entry.getValue();
> 156                     if (!re.address.equalsIgnoreCase(hostIp)){
> 157                         continue;
> 158                     }
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222161:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/XenServer620SP1Resource.java: 115 in
> com.cloud.hypervisor.xenserver.resource.XenServer620SP1Resource.getGP
> UGroupDetails(com.xensource.xenapi.Connection)()
> 109                 if(enabledVGPUTypes != null) {
> 110                     Iterator<VGPUType> it = enabledVGPUTypes.iterator();
> 111                     while (it.hasNext()) {
> 112                         VGPUType type = it.next();
> 113                         Record record = type.getRecord(conn);
> 114                         Long remainingCapacity =
> pgpu.getRemainingCapacity(conn, type);
> >>>     CID 1222161:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object
> "pgpu.getSupportedVGPUMaxCapacities(conn)".
> 115                         Long maxCapacity =
> pgpu.getSupportedVGPUMaxCapacities(conn).get(type);
> 116                         VgpuTypesInfo entry;
> 117                         if ((entry = gpuCapacity.get(record.modelName)) != null)
{
> 118                             remainingCapacity += entry.getRemainingCapacity();
> 119                             maxCapacity += entry.getMaxCapacity();
> 120                             entry.setRemainingCapacity(remainingCapacity);
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222160:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/XenServer620SP1Resource.java: 117 in
> com.cloud.hypervisor.xenserver.resource.XenServer620SP1Resource.getGP
> UGroupDetails(com.xensource.xenapi.Connection)()
> 111                     while (it.hasNext()) {
> 112                         VGPUType type = it.next();
> 113                         Record record = type.getRecord(conn);
> 114                         Long remainingCapacity =
> pgpu.getRemainingCapacity(conn, type);
> 115                         Long maxCapacity =
> pgpu.getSupportedVGPUMaxCapacities(conn).get(type);
> 116                         VgpuTypesInfo entry;
> >>>     CID 1222160:  Dereference null return value  (NULL_RETURNS)
> >>>     Accessing field of null object "record".
> 117                         if ((entry = gpuCapacity.get(record.modelName)) != null)
{
> 118                             remainingCapacity += entry.getRemainingCapacity();
> 119                             maxCapacity += entry.getMaxCapacity();
> 120                             entry.setRemainingCapacity(remainingCapacity);
> 121                             entry.setMaxVmCapacity(maxCapacity);
> 122                             gpuCapacity.put(record.modelName, entry);
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222159:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/XenServer620SP1Resource.java: 143 in
> com.cloud.hypervisor.xenserver.resource.XenServer620SP1Resource.create
> VGPU(com.xensource.xenapi.Connection,
> com.cloud.agent.api.StartCommand, com.xensource.xenapi.VM,
> com.cloud.agent.api.to.GPUDeviceTO)()
> 137             if (s_logger.isDebugEnabled()) {
> 138                 s_logger.debug("Creating VGPU of VGPU type [ " +
> gpuDevice.getVgpuType() + " ] in gpu group" + gpuDevice.getGpuGroup()
> 139                         + " for VM " + cmd.getVirtualMachine().getName());
> 140             }
> 141
> 142             Set<GPUGroup> groups = GPUGroup.getByNameLabel(conn,
> gpuDevice.getGpuGroup());
> >>>     CID 1222159:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "groups".
> 143             assert groups.size() == 1 : "Should only have 1 group but found "
> + groups.size();
> 144             GPUGroup gpuGroup = groups.iterator().next();
> 145
> 146             Set<VGPUType> vgpuTypes =
> gpuGroup.getEnabledVGPUTypes(conn);
> 147             Iterator<VGPUType> iter = vgpuTypes.iterator();
> 148             VGPUType vgpuType = null;
> 
> __________________________________________________________
> ______________________________________________
> *** CID 1222158:  Dereference null return value  (NULL_RETURNS)
> /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resou
> rce/XenServer620Resource.java: 84 in
> com.cloud.hypervisor.xenserver.resource.XenServer620Resource.hostHasH
> otFix(com.xensource.xenapi.Connection, java.lang.String)()
> 78                 Host host = Host.getByUuid(conn, _host.uuid);
> 79                 Host.Record re = host.getRecord(conn);
> 80                 Set<HostPatch> patches = re.patches;
> 81                 PoolPatch poolPatch = PoolPatch.getByUuid(conn, hotFixUuid);
> 82                 for(HostPatch patch : patches) {
> 83                     PoolPatch pp = patch.getPoolPatch(conn);
> >>>     CID 1222158:  Dereference null return value  (NULL_RETURNS)
> >>>     Calling a method on null object "pp".
> 84                     if (pp.equals(poolPatch) && patch.getApplied(conn)) {
> 85                         return true;
> 86                     }
> 87                 }
> 88              } catch (Exception e) {
> 89                 s_logger.debug("can't get patches information for hotFix: " +
> hotFixUuid);
> 
> 
> __________________________________________________________
> ______________________________________________
> 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
> 
> 

Mime
View raw message