Skip to content

sysfs: return untyped nil for hardware which is not there. - #778

Open
klihub wants to merge 1 commit into
containers:mainfrom
klihub:fixes/sysfs/return-untyped-nil
Open

sysfs: return untyped nil for hardware which is not there.#778
klihub wants to merge 1 commit into
containers:mainfrom
klihub:fixes/sysfs/return-untyped-nil

Conversation

@klihub

@klihub klihub commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

System.CPU, System.Node and System.Package returned a nil pointer inside a non-nil interface for an id the machine does not have. Such a value is never == nil, so callers' nil checks were dead code and the call after them panicked. Return an untyped nil instead, and stop dereferencing without checking in SingleThreadForCPUs and NodeDistance.

System.CPU, System.Node and System.Package returned a nil
pointer inside a non-nil interface for an id the machine does
not have. Such a value is never == nil, so callers' nil checks
were dead code and the call after them panicked. One such check
guards node and socket ids taken from a container's topology
hints, so a hint naming absent hardware brought the plugin
down.

Return an untyped nil instead, and stop dereferencing without
checking in SingleThreadForCPUs and NodeDistance.

Assisted-by: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Krisztian Litkey <[email protected]>
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.

1 participant