The branch main has been updated by tsoome:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=575529a92d7b35628daace82c2965984c6376e2e

commit 575529a92d7b35628daace82c2965984c6376e2e
Author:     Toomas Soome <[email protected]>
AuthorDate: 2026-07-13 19:15:40 +0000
Commit:     Toomas Soome <[email protected]>
CommitDate: 2026-07-13 19:15:40 +0000

    bhyve: unsigned <= 0
    
    illumos smatch build is complaining:
        pci_nvme_parse_config() warn: 'sc->max_qentries' unsigned <= 0
        pci_nvme_parse_config() warn: 'sc->ioslots' unsigned <= 0
    
    Because we are using atoi() to translate string to int, we need
    to use int type variable for translation.
    
    Reviewed by:    bnovkov
    Differential Revision:  https://reviews.freebsd.org/D58213
---
 usr.sbin/bhyve/pci_nvme.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index 7e6c8bc9d719..3656ee7a8d65 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -3167,6 +3167,7 @@ pci_nvme_parse_config(struct pci_nvme_softc *sc, nvlist_t 
*nvl)
        char bident[sizeof("XXX:XXX")];
        const char *value;
        uint32_t sectsz;
+       int val;
 
        sc->max_queues = NVME_QUEUES;
        sc->max_qentries = NVME_MAX_QENTRIES;
@@ -3183,20 +3184,21 @@ pci_nvme_parse_config(struct pci_nvme_softc *sc, 
nvlist_t *nvl)
                sc->max_queues = atoi(value);
        value = get_config_value_node(nvl, "qsz");
        if (value != NULL) {
-               sc->max_qentries = atoi(value);
-               if (sc->max_qentries <= 0) {
-                       EPRINTLN("nvme: Invalid qsz option %d",
-                           sc->max_qentries);
+               val = atoi(value);
+               if (val <= 0) {
+                       EPRINTLN("nvme: Invalid qsz option %d", val);
                        return (-1);
                }
+               sc->max_qentries = val;
        }
        value = get_config_value_node(nvl, "ioslots");
        if (value != NULL) {
-               sc->ioslots = atoi(value);
-               if (sc->ioslots <= 0) {
-                       EPRINTLN("Invalid ioslots option %d", sc->ioslots);
+               val = atoi(value);
+               if (val <= 0) {
+                       EPRINTLN("Invalid ioslots option %d", val);
                        return (-1);
                }
+               sc->ioslots = val;
        }
        value = get_config_value_node(nvl, "sectsz");
        if (value != NULL)

Reply via email to