Skip to content

Fix comparison-with-wider-type CodeQL issue#129742

Merged
janvorli merged 2 commits into
dotnet:mainfrom
janvorli:fix-codeql-issue
Jun 24, 2026
Merged

Fix comparison-with-wider-type CodeQL issue#129742
janvorli merged 2 commits into
dotnet:mainfrom
janvorli:fix-codeql-issue

Conversation

@janvorli

Copy link
Copy Markdown
Member

CodeQL has complained about a loop with heap_num variable of 16 bit type and n_heaps of 32 bit type.

CodeQL has complained about a loop with heap_num variable of 16 bit
type and n_heaps of 32 bit type.
@janvorli janvorli added this to the 11.0.0 milestone Jun 23, 2026
@janvorli janvorli requested a review from kkokosa June 23, 2026 12:45
@janvorli janvorli self-assigned this Jun 23, 2026
Copilot AI review requested due to automatic review settings June 23, 2026 12:45
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @anicka-net, @dotnet/gc
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the GC heap_select::init heap enumeration loop to avoid mixed-width comparisons flagged by CodeQL, while preserving existing heap-to-processor/NUMA discovery behavior.

Changes:

  • Change heap_num loop variable from uint16_t to int when iterating up to n_heaps.
  • Add an explicit cast when passing heap_num to GCToOSInterface::GetProcessorForHeap(...) (which takes a uint16_t).

Comment thread src/coreclr/gc/gcinternal.h Outdated
@janvorli janvorli merged commit e3cbc00 into dotnet:main Jun 24, 2026
106 of 109 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot modified the milestones: 11.0.0, 11.0-preview7 Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants