Skip to content

Commit eb911bf

Browse files
committed
[GPU] Fix coverity issue
+ Fix int64_t overflow sink
1 parent 92e7f5e commit eb911bf

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/plugins/intel_gpu/src/graph/common_utils/jit_term.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,14 @@ inline JitTerm operator/(const JitTerm& lhs, const JitTerm& rhs) {
220220
return JitTerm{"(" + lhs.str() + " / " + rhs.str() + ")"};
221221
}
222222
inline JitTerm operator%(const JitTerm& lhs, const JitTerm& rhs) {
223-
OPENVINO_ASSERT(rhs.str() != "0");
224-
if (rhs.str() == "1" || rhs.str() == "-1") {
225-
return JitTerm{"0"};
226-
}
227-
228223
if (is_number(lhs) && is_number(rhs)) {
229224
auto rhs_val = as_number<int64_t>(rhs);
230225
OPENVINO_ASSERT(rhs_val != 0, "Modulo by zero detected in operator%");
226+
if (rhs_val == 1 || rhs_val == -1) {
227+
return JitTerm{"0"};
228+
}
231229
return JitTerm{std::to_string(as_number<int64_t>(lhs) % rhs_val)};
232230
}
233-
234231
return JitTerm{"(" + lhs.str() + " % " + rhs.str() + ")"};
235232
}
236233
inline JitTerm operator++(JitTerm& t, int) {

0 commit comments

Comments
 (0)