The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=a0486017c2a453ce5e8b6e678a14e7d5577c1300
commit a0486017c2a453ce5e8b6e678a14e7d5577c1300 Author: Toomas Soome <[email protected]> AuthorDate: 2026-07-21 06:33:38 +0000 Commit: Toomas Soome <[email protected]> CommitDate: 2026-07-21 06:33:38 +0000 bhyve: check upper bounds for value from qsz 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 Reviewed by: chuck Differential Revision: https://reviews.freebsd.org/D58293 --- usr.sbin/bhyve/pci_nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 3656ee7a8d65..b2b9f0ff88a8 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -3185,7 +3185,7 @@ pci_nvme_parse_config(struct pci_nvme_softc *sc, nvlist_t *nvl) value = get_config_value_node(nvl, "qsz"); if (value != NULL) { val = atoi(value); - if (val <= 0) { + if (val <= 0 || val > UINT16_MAX) { EPRINTLN("nvme: Invalid qsz option %d", val); return (-1); }
