Skip to content

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

[core] Fix Coverity issues core and inference (#34786)

Pawel Raasza55e60168700
diff --git a/src/core/src/pass/sdpa_to_paged_attention.cpp b/src/core/src/pass/sdpa_to_paged_attention.cpp
index 65c6eeba015..7ac2eaa5e89 100644
--- a/src/core/src/pass/sdpa_to_paged_attention.cpp
+++ b/src/core/src/pass/sdpa_to_paged_attention.cpp
@@ -153,7 +153,7 @@ bool ov::pass::SDPAToPagedAttention::run_on_model(const std::shared_ptr<ov::Mode
if (auto token_type_ids_param = get_parameter(model, "token_type_ids")) {
token_type_ids_param->validate_and_infer_types();
- optional_model_wide_params["token_type_ids"] = token_type_ids_param;
+ optional_model_wide_params["token_type_ids"] = std::move(token_type_ids_param);
}
std::shared_ptr<v0::Parameter> position_ids;
@@ -162,7 +162,7 @@ bool ov::pass::SDPAToPagedAttention::run_on_model(const std::shared_ptr<ov::Mode
model->add_parameters({position_ids});
} else {
position_ids = ov::as_type_ptr<v0::Parameter>(model->input("position_ids").get_node_shared_ptr());
- const auto position_ids_shape = position_ids->get_partial_shape();
+ const auto& position_ids_shape = position_ids->get_partial_shape();
if (position_ids_shape.rank().is_static() && position_ids_shape.rank().get_length() == 2) {
position_ids->set_partial_shape(PartialShape{-1});
@@ -291,4 +291,4 @@ bool ov::pass::SDPAToPagedAttention::run_on_model(const std::shared_ptr<ov::Mode
model->add_parameters({std::move(max_context_len)});
model->validate_nodes_and_infer_types();
return true;
-}
\ No newline at end of file
+}
diff --git a/src/inference/src/dev/isync_infer_request.cpp b/src/inference/src/dev/isync_infer_request.cpp
index 609b9ee521f..31c4f995414 100644
--- a/src/inference/src/dev/isync_infer_request.cpp
+++ b/src/inference/src/dev/isync_infer_request.cpp
@@ -194,7 +194,7 @@ void ov::ISyncInferRequest::convert_batched_tensors() {
const auto& tensor = item.second.at(i);
memcpy(ptr + i * tensor->get_byte_size(), tensor->data(), tensor->get_byte_size());
});
- prepared_tensors[item.first] = input_tensor;
+ prepared_tensors[item.first] = std::move(input_tensor);
}
for (const auto& item : prepared_tensors) {
diff --git a/src/inference/src/single_file_storage.cpp b/src/inference/src/single_file_storage.cpp
index 58961aebae3..0cf903597d9 100644
--- a/src/inference/src/single_file_storage.cpp
+++ b/src/inference/src/single_file_storage.cpp
@@ -145,7 +145,7 @@ bool SingleFileStorage::build_content_index(std::ifstream& stream) {
return false;
}
if (std::string model_name; read_tlv_string(s, model_name)) {
- m_blob_index[id].model_name = model_name;
+ m_blob_index[id].model_name = std::move(model_name);
}
return s.good();
};
@@ -250,7 +250,7 @@ void SingleFileStorage::write_blob_entry(std::ofstream& stream, BlobIdType blob_
};
write_tlv_record(stream, static_cast<TLVTraits::TagType>(Tag::BlobMap), blob_map_writer);
- m_blob_index[blob_id] = {blob_pos, blob_size, model_name};
+ m_blob_index[blob_id] = {blob_pos, blob_size, std::move(model_name)};
}
void SingleFileStorage::write_cache_entry(const std::string& blob_id, StreamWriter writer) {