Two were found by the compiler when enabling extra warnings. One, the
apparent cause of PR 265749, was found by code inspection.
PR: 265749
Differential D36119
bhyve: Fix uses of uninitialized variables in pci_nvme.c markj on Aug 10 2022, 5:30 PM. Authored by Tags None Referenced Files
Details
Two were found by the compiler when enabling extra warnings. One, the PR: 265749
Diff Detail
Event Timeline
Comment Actions looks sensible
Comment Actions Well, all of the warnings have to be fixed first, since we typically build with -Werror. I started working on it. I think we have to set -Wno-unused-parameter for now though, there are too many things to fix otherwise. Comment Actions All of these changes are fine, but the fact that they are necessary has me worried. Does what I've coded wander into undefined behavior territory?
Comment Actions Using variables without initializing them is generally (though not always) undefined behaviour, yes. Part of the longer-term solution will be to enable stricter compiler warnings in the bhyve build, but for that, existing warnings have to be addressed first. PR 265749 mentions an NVMe compliance test suite, but we don't currently run it in our regression test suite; would it be possible to do so? Finally, we really need some stubs that would let us compile and fuzz device models in userspace.
Comment Actions In this review, a couple of warnings about uninitialized variables I found by removing the WARNS?=2 line in the Makefile and recompiling pci_nvme.c. D36118 contains fixes for most of the other warnings in that file. Everything else I did so far is not in phabricator yet. Comment Actions What if change in Makefile also put to review? I vote to increasing levels of warning in all code. Comment Actions Unfortunately, that test suite is not public, but perhaps the FreeBSD Foundation could negotiate something with UNH to be able to run it. Typically, I'm running it prior to commit bhyve NVMe changes.
|