OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[core] Suppress coverity issues (#32635)
Tomasz Jankowskia625f6f507f6
diff --git a/src/core/reference/include/openvino/reference/scaled_dot_product_attention.hpp b/src/core/reference/include/openvino/reference/scaled_dot_product_attention.hppindex 5ca3f633569..8e55520e842 100644--- a/src/core/reference/include/openvino/reference/scaled_dot_product_attention.hpp+++ b/src/core/reference/include/openvino/reference/scaled_dot_product_attention.hpp@@ -100,7 +100,7 @@ void scaled_dot_product_attention(const T* query,}const float default_scale_val = 1.0f / static_cast<float>(std::sqrt(query_shape[query_shape.size() - 1]));- const T scale_val = scale ? *scale : static_cast<T>(default_scale_val);+ const T scale_val[1] = {scale ? *scale : static_cast<T>(default_scale_val)};auto qk_shape = query_shape;qk_shape[qk_shape.size() - 1] = key_shape[key_shape.size() - 2];@@ -109,7 +109,7 @@ void scaled_dot_product_attention(const T* query,ov::reference::matmul<T>(query, key, qk_data.data(), query_shape, key_shape, qk_shape, false, true);ov::reference::multiply<T>(qk_data.data(),- &scale_val,+ scale_val,qk_data.data(),qk_shape,Shape{1},@@ -172,4 +172,4 @@ void scaled_dot_product_attention(const T* query,ov::reference::matmul<T>(qk_data_softmax.data(), value, output, qk_shape, value_shape, output_shape, false, false);}} // namespace reference-} // namespace ov\ No newline at end of file+} // namespace ovdiff --git a/src/core/src/any.cpp b/src/core/src/any.cppindex d99eb641997..fdf43ac2fc2 100644--- a/src/core/src/any.cpp+++ b/src/core/src/any.cpp@@ -157,6 +157,8 @@ void Any::impl_check() const {const std::type_info& Any::type_info() const {impl_check();+ // `impl_check' asserts valid deference+ // coverity[dereference:FALSE]return _impl->type_info();}diff --git a/src/core/src/runtime/itensor.cpp b/src/core/src/runtime/itensor.cppindex 66e9a9c7ce5..bf67835f38b 100644--- a/src/core/src/runtime/itensor.cpp+++ b/src/core/src/runtime/itensor.cpp@@ -60,6 +60,8 @@ bool ITensor::is_continuous() const {}const auto default_last = default_strides.rend();+ // It assumed that `default_strides' and `strides' have the same size, thus `default_stride' iterator is valid+ // coverity[deref_iterator:SUPPRESS]return (default_stride == default_last) || (*default_stride < *stride && (get_shape()[0] == 1) &&std::all_of(default_stride, default_last, cmp::Equal(*default_stride)));}diff --git a/src/core/xml_util/src/xml_deserialize_util.cpp b/src/core/xml_util/src/xml_deserialize_util.cppindex 14323cc511a..457a7e55a1c 100644--- a/src/core/xml_util/src/xml_deserialize_util.cpp+++ b/src/core/xml_util/src/xml_deserialize_util.cpp@@ -125,6 +125,9 @@ std::unordered_set<std::string> deserialize_tensor_names(const std::string_view&*name_inserter = std::regex_replace(std::string(name_view), escaped_delim, delim);}start = pos;+ // There's no real case when `pos' equals zero and following test `delim_pos != std::string::npos' protects+ // against it.+ // coverity[ overflow_const:SUPPRESS]} else if (auto delim_pos = pos - 1; delim_pos != std::string::npos && tensor_names[delim_pos] == esc_char) {++pos;} else {