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
F172197307: D58293.diff
Wed, Sep 16, 7:11 PM
Unknown Object (File)
Sun, Sep 13, 12:55 PM
Unknown Object (File)
Sat, Sep 12, 9:16 AM
Unknown Object (File)
Sat, Sep 12, 9:05 AM
Unknown Object (File)
Fri, Sep 11, 5:44 PM
Unknown Object (File)
Fri, Sep 11, 8:24 AM
Unknown Object (File)
Sat, Sep 5, 8:37 PM
Unknown Object (File)
Sat, Sep 5, 8:37 PM

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.