Page MenuHomeFreeBSD

bus: Return 0 if reading an ivar fails
ClosedPublic

Authored by des on Dec 4 2025, 9:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 28, 7:02 AM
Unknown Object (File)
Mon, Apr 27, 11:43 PM
Unknown Object (File)
Mon, Apr 27, 1:27 PM
Unknown Object (File)
Mon, Apr 27, 1:27 PM
Unknown Object (File)
Wed, Apr 15, 2:02 PM
Unknown Object (File)
Sat, Apr 4, 3:19 PM
Unknown Object (File)
Mar 25 2026, 1:07 AM
Unknown Object (File)
Mar 17 2026, 9:03 PM
Subscribers

Details

Summary

In the non-INVARIANTS case, return 0 rather than stack garbage if
reading an ivar fails (in the INVARIANTS case, we still panic).

MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Dec 4 2025, 9:01 PM

Hmmm, I wonder if 0 is the right thing vs something like 0xdeadc0de. We have a few explicit IVAR handlers that intentionally return a default value (e.g. acpi_get_handle()) and those do tend to be zero (and in those cases we don't KASSERT). I have a patch in a branch to add a new one like that for ThunderBolt PCI bridges even. 0 is probably fine as a default, but @imp might also have an opinion.

This revision is now accepted and ready to land.Dec 5 2025, 1:16 PM
This revision was automatically updated to reflect the committed changes.