Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[NPUW]Coverity fix - nullptr validation. (#36436)

intelgaoxiongde66d4df9f2f
diff --git a/src/plugins/intel_npu/src/plugin/npuw/util.cpp b/src/plugins/intel_npu/src/plugin/npuw/util.cpp
index 07a2f38a957..c746c1f84c5 100644
--- a/src/plugins/intel_npu/src/plugin/npuw/util.cpp
+++ b/src/plugins/intel_npu/src/plugin/npuw/util.cpp
@@ -894,7 +894,9 @@ ov::npuw::util::TensorPtr ov::npuw::util::allocMem(const ov::element::Type type,
return ov::get_tensor_impl(ov::Tensor(type, shape));
}
+ OPENVINO_ASSERT(plugin, "allocMem: plugin must be non-null for non-CPU device '", device, "'");
auto remote_ctx = plugin->get_core()->get_default_context(device)._ptr;
+ OPENVINO_ASSERT(remote_ctx, "allocMem: failed to obtain remote context for device '", device, "'");
auto remote_tensor = remote_ctx->create_host_tensor(type, shape);
return ov::get_tensor_impl(ov::make_tensor(remote_tensor));
}