Page MenuHomeFreeBSD

riscv: Do MPASS check on hyp pointer before using it
Needs ReviewPublic

Authored by doonbsd_gmail.com on Sat, Jan 24, 6:04 AM.
Tags
None
Referenced Files
F143043678: D54856.id170323.diff
Sun, Jan 25, 11:24 AM
F143031030: D54856.diff
Sun, Jan 25, 9:31 AM
F143013308: D54856.diff
Sun, Jan 25, 6:44 AM
F143000092: D54856.id.diff
Sun, Jan 25, 4:44 AM
Unknown Object (File)
Sat, Jan 24, 9:02 PM
Unknown Object (File)
Sat, Jan 24, 8:24 PM
Unknown Object (File)
Sat, Jan 24, 8:19 PM
Unknown Object (File)
Sat, Jan 24, 12:58 PM

Details

Reviewers
jhb
Group Reviewers
bhyve
Summary

The check on hyp pointer is done later than just before
using it for the first time. Move the MPASS check just
before using the pointer for the first time.

Signed-off-by: Doongar Singh <doonbsd@gmail.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 70105
Build 66988: arc lint + arc unit

Event Timeline

Better would just be to remove the assertion IMO. It's a bit silly to assert that malloc(M_WAITOK) returns a non-NULL pointer.

Well it is where it is because (a) asserting in vmmops_init is pointless with M_WAITOK as you say (b) vm_init is in a separate translation unit so in some world views should treat vmmops_init as a black box, and is therefore asserting that it never fails. And this pattern is copied from arm64, so we should keep the two consistent, whichever way it goes.

Well it is where it is because (a) asserting in vmmops_init is pointless with M_WAITOK as you say (b) vm_init is in a separate translation unit so in some world views should treat vmmops_init as a black box, and is therefore asserting that it never fails. And this pattern is copied from arm64, so we should keep the two consistent, whichever way it goes.

"vm_init" is implementation specific. I understand point (a) but as per (b) it's unnecessary that two architectures have the exact same implementation line by line. As of now for both architectures don't need this check.

I agree that we should keep arm64 consistent at the very least. I tend to think that asserting that a pointer is non-NULL is silly, but on second thought a patch that just removes assertions is also a bit silly. So I'd rather just leave these alone.

I agree that we should keep arm64 consistent at the very least. I tend to think that asserting that a pointer is non-NULL is silly, but on second thought a patch that just removes assertions is also a bit silly. So I'd rather just leave these alone.

Sure.