Skip to content

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

[GPU][Coverity] Fix overflowed constant in ScatterUpdateKernelRef::GetJitConstants (#35762)

Sungeun Kimc9abcacdc472
diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/scatter_update/scatter_update_kernel_ref.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/scatter_update/scatter_update_kernel_ref.cpp
index 05d9f5ad66b..f3bb2517fc8 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/scatter_update/scatter_update_kernel_ref.cpp
+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/scatter_update/scatter_update_kernel_ref.cpp
@@ -216,7 +216,7 @@ JitConstants ScatterUpdateKernelRef::GetJitConstants(const scatter_update_params
std::string def_pitch = "UPDATES_" + GetAxisName(dims, i) + "_PITCH";
std::string src_pitch = "1";
jit.AddConstant(MakeJitConstant(def_pitch, src_pitch));
- } else if (i == (axis_value - 1)) {
+ } else if (axis_value > 0 && i == (axis_value - 1)) {
get_update_idx_src += default_order[i] + ", ";
std::string def_pitch = "UPDATES_" + GetAxisName(dims, i) + "_PITCH";
std::string src_pitch = "(UPDATES_" + GetAxisName(dims, i + 1) + "_PITCH * INDICES_SIZE)";