Fix for incorrect conversion between integer types#679
Merged
Conversation
There was a problem hiding this comment.
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 int64 → int), adjusting GetGlobalNumaStats to use int64 node keys end-to-end.
Changes:
- Change
GetGlobalNumaStatsreturn type frommap[int]GlobalNumaStatstomap[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.
CodeQL finding. Signed-off-by: Ukri Niemimuukko <ukri.niemimuukko@intel.com>
kad
approved these changes
Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.