Page MenuHomeFreeBSD

vm_reserv: clarify reserv_from_object
ClosedPublic

Authored by dougm on Mar 19 2025, 10:33 PM.
Tags
None
Referenced Files
F115918303: D49415.id152427.diff
Wed, Apr 30, 9:55 AM
Unknown Object (File)
Thu, Apr 24, 3:00 AM
Unknown Object (File)
Fri, Apr 11, 6:37 AM
Unknown Object (File)
Wed, Apr 9, 8:12 AM
Unknown Object (File)
Sat, Apr 5, 6:54 AM
Unknown Object (File)
Fri, Apr 4, 3:36 PM
Unknown Object (File)
Mar 26 2025, 8:46 PM
Unknown Object (File)
Mar 24 2025, 3:21 AM
Subscribers

Details

Summary

vm_reserv_from_page returns an existing reservation, or initializes a successor pointer, or both. If it returns an existing reservation, callers will ignore the successor pointer, initialized or not, so initializing it serves no purpose. So, don't initialize it in that case, and make less ambiguous the comment that describes the function's behavior.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

dougm created this revision.

Doesn't this leave msucc uninitialized in vm_reserv_from_object()'s callers? I think we can then reach a msucc != NULL test there even if vm_reserv_from_object() returns a non-NULL pointer.

Doesn't this leave msucc uninitialized in vm_reserv_from_object()'s callers?

Only if the function returns a non-NULL value.

I think we can then reach a msucc != NULL test there even if vm_reserv_from_object() returns a non-NULL pointer.

I disagree. After each call, an rv != NULL test leads to a block that includes return statements, with no way to avoid encountering one of them.

This revision is now accepted and ready to land.Mar 23 2025, 10:42 PM
This revision was automatically updated to reflect the committed changes.