Page MenuHomeFreeBSD

bhyve: check upper bounds for value from qsz
ClosedPublic

Authored by tsoome on Fri, Jul 17, 8:14 AM.
Tags
None
Referenced Files
F164677063: D58293.id182107.diff
Mon, Aug 3, 3:13 AM
F164648302: D58293.diff
Sun, Aug 2, 9:56 PM
Unknown Object (File)
Sun, Aug 2, 8:46 AM
Unknown Object (File)
Sat, Aug 1, 7:16 AM
Unknown Object (File)
Sat, Aug 1, 4:49 AM
Unknown Object (File)
Fri, Jul 31, 3:51 AM
Unknown Object (File)
Wed, Jul 29, 10:46 AM
Unknown Object (File)
Mon, Jul 27, 6:15 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 74864
Build 71747: arc lint + arc unit

Event Timeline

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

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.Sat, Jul 18, 10:26 PM

declare val at the beginning of function.

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