Page MenuHomeFreeBSD

vm_reserv: clarify reserv_from_object
ClosedPublic

Authored by dougm on Mar 19 2025, 10:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 20, 3:40 PM
Unknown Object (File)
Thu, Nov 20, 3:35 PM
Unknown Object (File)
Thu, Nov 20, 3:35 PM
Unknown Object (File)
Thu, Nov 20, 3:25 PM
Unknown Object (File)
Tue, Nov 18, 2:44 PM
Unknown Object (File)
Tue, Nov 11, 8:46 PM
Unknown Object (File)
Tue, Nov 4, 6:56 PM
Unknown Object (File)
Sat, Nov 1, 3:52 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

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

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.