Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tools/unitrace/src/levelzero/ze_metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,9 @@ class ZeMetricProfiler {
}
}
value += samples[i];
if (kit == kinfo.end()) {
break;
}
Comment on lines 1158 to +1161
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check occurs after value += samples[i] at line 1158, but the iterator kit is used or incremented in the inner loop above. If kit was incremented to kinfo.end() in the inner loop and the code breaks from it, then continues to line 1158, there's a potential that kit might be dereferenced between the break point and this check. Verify that no dereference of kit occurs at line 1158 or ensure this check happens immediately after the inner loop before any potential use of kit.

Suggested change
value += samples[i];
if (kit == kinfo.end()) {
break;
}
if (kit == kinfo.end()) {
break;
}
value += samples[i];

Copilot uses AI. Check for mistakes.
}
}
}
Expand Down