Page MenuHomeFreeBSD

bhyve: check upper bounds for value from qsz
ClosedPublic

Authored by tsoome on Jul 17 2026, 8:14 AM.
Tags
None
Referenced Files
F167517754: D58293.diff
Sat, Aug 22, 10:35 AM
Unknown Object (File)
Tue, Aug 18, 1:31 AM
Unknown Object (File)
Fri, Aug 14, 5:03 PM
Unknown Object (File)
Fri, Aug 14, 5:03 PM
Unknown Object (File)
Fri, Aug 14, 5:03 PM
Unknown Object (File)
Fri, Aug 14, 5:03 PM
Unknown Object (File)
Fri, Aug 14, 5:01 PM
Unknown Object (File)
Thu, Aug 13, 3:46 AM

Details

Summary

The max_qentries in pci_nvme_softc is uint16_t and
too large int may get truncated to invalid value.
While there, use local declarations for val.

Suggested by: Bill Sommerfeld

Diff Detail

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

Event Timeline

bnovkov added inline comments.
usr.sbin/bhyve/pci_nvme.c
3188

Why aren't we defining val at the start of the function anymore?

chuck added a subscriber: chuck.

Assuming you restore the declaration of val as @bnovkov suggested, LGTM.

This revision is now accepted and ready to land.Jul 18 2026, 10:26 PM

declare val at the beginning of function.

This revision now requires review to proceed.Jul 19 2026, 1:27 PM
This revision is now accepted and ready to land.Jul 19 2026, 3:38 PM
This revision was automatically updated to reflect the committed changes.