Skip to content

Commit ea7c8ac

Browse files
authored
[Snippets] Fix invalid iterator and null pointer dereference Coverity remarks (#30437)
### Details: Fix Coverity remarks: - 2360985, 2360976, 2360969: Using invalid iterator - 2356388: Dereference null return value ### Tickets: - 167167
1 parent bb55ead commit ea7c8ac

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/common/snippets/src/lowered/pass/mark_invariant_shape_path.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static bool is_affecting_op(const ExpressionPtr& expr) {
4646
size_t MarkInvariantShapePath::getInvariantPortShapePath(const ExpressionPort& port) {
4747
auto& rt = get_rt_info(port);
4848
const auto rinfo = rt.find("InvariantShapePath");
49-
assert(rinfo != rt.end() && "Invariant path for this expression port has not been marked!");
49+
OPENVINO_ASSERT(rinfo != rt.end(), "Invariant path for this expression port has not been marked!");
5050
return rinfo->second.as<size_t>();
5151
}
5252

src/common/snippets/src/op/memory_access.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void MemoryAccess::set_output_port_descriptor(const PortDescriptor& desc, const
105105

106106
const MemoryAccess::PortDescriptor& MemoryAccess::get_input_port_descriptor(const size_t i) const {
107107
const auto it = m_input_ports.find(i);
108-
assert(it != m_input_ports.end() && "Index of input port descriptor should be less than count of input ports");
108+
OPENVINO_ASSERT(it != m_input_ports.end(), "Index of input port descriptor should be less than count of input ports");
109109
return it->second;
110110
}
111111

@@ -115,7 +115,7 @@ MemoryAccess::PortDescriptor& MemoryAccess::get_input_port_descriptor(const size
115115

116116
const MemoryAccess::PortDescriptor& MemoryAccess::get_output_port_descriptor(const size_t i) const {
117117
const auto it = m_output_ports.find(i);
118-
assert(it != m_output_ports.end() && "Index of output port descriptor should be less than count of output ports");
118+
OPENVINO_ASSERT(it != m_output_ports.end(), "Index of output port descriptor should be less than count of output ports");
119119
return it->second;
120120
}
121121

src/common/snippets/src/pass/transform_convert.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ ov::snippets::pass::TransformConvertToConvertTruncation::TransformConvertToConve
2424
OV_ITT_SCOPED_TASK(ov::pass::itt::domains::SnippetsTransform, "Snippets::op::TransformConvertToConvertTruncation")
2525
const auto root = m.get_match_root();
2626
const auto convert = ov::as_type_ptr<ov::opset1::Convert>(root);
27+
OPENVINO_ASSERT(convert, "Convert op is invalid");
2728
auto convert_truncation = std::make_shared<op::ConvertTruncation>(convert->get_input_source_output(0),
2829
convert->get_destination_type());
2930
convert_truncation->set_friendly_name(convert->get_friendly_name());

0 commit comments

Comments
 (0)