Skip to content

Fix for incorrect conversion between integer types#679

Merged
askervin merged 1 commit into
containers:mainfrom
uniemimu:isolfix
Jun 17, 2026
Merged

Fix for incorrect conversion between integer types#679
askervin merged 1 commit into
containers:mainfrom
uniemimu:isolfix

Conversation

@uniemimu

Copy link
Copy Markdown
Contributor

Fix for a CodeQL finding.

Technically this is an API change, but the function GetGlobalNumaStats is not used anywhere based on my searches. Not inside nri-plugins, nor elsewhere in github at least, or anything that would have been caught by the Google search engine. I would say this is a safe enough fix.

An alternative would be to remove the entire function or to replace the call to ParseInt with a call to Atoi.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a CodeQL finding by removing a potentially unsafe narrowing conversion when indexing global NUMA stats by node id (previously int64int), adjusting GetGlobalNumaStats to use int64 node keys end-to-end.

Changes:

  • Change GetGlobalNumaStats return type from map[int]GlobalNumaStats to map[int64]GlobalNumaStats.
  • Remove the int(node) cast when populating the result map.
  • Update empty-map returns to the new key type.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/cgroups/cgroupstats.go
Comment thread pkg/cgroups/cgroupstats.go
CodeQL finding.

Signed-off-by: Ukri Niemimuukko <ukri.niemimuukko@intel.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread pkg/cgroups/cgroupstats.go

@askervin askervin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@askervin askervin merged commit 90b74a6 into containers:main Jun 17, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants