Date: Tue, 21 Jul 2026 07:08:21 +0000 From: Toomas Soome <tsoome@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: a0486017c2a4 - main - bhyve: check upper bounds for value from qsz Message-ID: <6a5f1ae5.44ba8.3df9ddeb@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=a0486017c2a453ce5e8b6e678a14e7d5577c1300 commit a0486017c2a453ce5e8b6e678a14e7d5577c1300 Author: Toomas Soome <tsoome@FreeBSD.org> AuthorDate: 2026-07-21 06:33:38 +0000 Commit: Toomas Soome <tsoome@FreeBSD.org> 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); }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a5f1ae5.44ba8.3df9ddeb>
