Skip to content

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

Fix coverity issues (#30082)

Ivan Tikhonov314f4617af20
diff --git a/src/common/low_precision_transformations/src/pull_reshape_through_dequantization.cpp b/src/common/low_precision_transformations/src/pull_reshape_through_dequantization.cpp
index ff172a0a0b4..6a1db8c3621 100644
--- a/src/common/low_precision_transformations/src/pull_reshape_through_dequantization.cpp
+++ b/src/common/low_precision_transformations/src/pull_reshape_through_dequantization.cpp
@@ -134,8 +134,16 @@ ov::pass::low_precision::PullReshapeThroughDequantization::PullReshapeThroughDeq
ov::matcher_pass_callback callback = [=](ov::pass::pattern::Matcher & m) -> bool {
const auto& opsMap = m.get_pattern_value_map();
auto reshape = opsMap.at(reshapeWrapper).get_node_shared_ptr();
+ if (reshape == nullptr) {
+ return false;
+ }
+
+ auto reshape_target_inputs = reshape->get_output_target_inputs(0);
+ if (reshape_target_inputs.empty()) {
+ return false;
+ }
- auto child = reshape->get_output_target_inputs(0).begin()->get_node();
+ auto child = reshape_target_inputs.begin()->get_node();
if (ov::is_type<opset1::GroupConvolution>(child)) {
return false;
}
@@ -150,7 +158,7 @@ ov::pass::low_precision::PullReshapeThroughDequantization::PullReshapeThroughDeq
pull_reshape_through_dequantization::fuseConstant(reshape, ov::as_type_ptr<opset1::Constant>(parent));
reshape = nullptr;
} else {
- THROW_IE_LPT_EXCEPTION(*parent) << "unexepcted operation type";
+ THROW_IE_LPT_EXCEPTION(*parent) << " unexpected operation type";
}
} while (reshape != nullptr);
diff --git a/src/common/transformations/src/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.cpp b/src/common/transformations/src/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.cpp
index 7b0ec5815fd..e14dcf2e730 100644
--- a/src/common/transformations/src/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.cpp
+++ b/src/common/transformations/src/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.cpp
@@ -96,8 +96,7 @@ public:
};
auto node = m.get_match_root();
- if (ov::is_type<ov::op::util::MultiSubGraphOp>(node)) {
- auto multi_subgraph_op = ov::as_type_ptr<ov::op::util::MultiSubGraphOp>(node);
+ if (auto multi_subgraph_op = ov::as_type_ptr<ov::op::util::MultiSubGraphOp>(node)) {
const auto& models = multi_subgraph_op->get_functions();
for (size_t body_idx = 0; body_idx < models.size(); ++body_idx) {
diff --git a/src/common/transformations/src/transformations/fp16_compression/mark_decompression_convert_constant_folding.cpp b/src/common/transformations/src/transformations/fp16_compression/mark_decompression_convert_constant_folding.cpp
index 646e65b467d..a28e97d583a 100644
--- a/src/common/transformations/src/transformations/fp16_compression/mark_decompression_convert_constant_folding.cpp
+++ b/src/common/transformations/src/transformations/fp16_compression/mark_decompression_convert_constant_folding.cpp
@@ -129,9 +129,13 @@ pass::MarkCompressedFloatConstants::MarkCompressedFloatConstants() {
matcher_pass_callback callback = [=](pattern::Matcher& m) {
const auto& convert_node = as_type_ptr<ov::op::v0::Convert>(m.get_match_root());
+ if (convert_node == nullptr)
+ return false;
+
const auto& const_node = convert_node->input_value(0).get_node_shared_ptr();
- if (convert_node == nullptr || const_node == nullptr)
+ if (const_node == nullptr)
return false;
+
if (convert_node->get_destination_type() != element::f32)
return false;
if (const_node->get_output_element_type(0) != element::f16 &&
diff --git a/src/common/transformations/src/transformations/transpose_sinking/ts_gather.cpp b/src/common/transformations/src/transformations/transpose_sinking/ts_gather.cpp
index f90c5b66096..e37d93e4438 100644
--- a/src/common/transformations/src/transformations/transpose_sinking/ts_gather.cpp
+++ b/src/common/transformations/src/transformations/transpose_sinking/ts_gather.cpp
@@ -163,13 +163,13 @@ TSGatherBackward::TSGatherBackward() {
auto transpose = as_type_ptr<ov::op::v1::Transpose>(pattern_to_output.at(transpose_label));
auto main_node = as_type_ptr<ov::op::v8::Gather>(pattern_to_output.at(gather_label));
- if (transformation_callback(main_node) || !main_node) {
+ if (!transpose || !main_node || transformation_callback(main_node)) {
return false;
}
auto transpose_order = as_type_ptr<ov::op::v0::Constant>(transpose->get_input_node_shared_ptr(1));
auto gather_axis = as_type_ptr<ov::op::v0::Constant>(main_node->get_input_node_shared_ptr(2));
- if (!transpose || !transpose_order || !gather_axis) {
+ if (!transpose_order || !gather_axis) {
return false;
}