The branch main has been updated by jhb:

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

commit c8703409edb782b953b89d517a1757756788ce18
Author:     John Baldwin <[email protected]>
AuthorDate: 2024-05-07 20:45:51 +0000
Commit:     John Baldwin <[email protected]>
CommitDate: 2024-05-07 20:54:00 +0000

    nvmecontrol: Fix a sign compare mismatch
    
    Even though mqes (uint16_t) and queue_size (u_int) are both unsigned,
    the expression 'mqes + 1' gets promoted to int which is signed.  Keep
    the value unsigned by explicitly promoting mqes to u_int before
    incrementing the value.
    
    Reported by:    GCC
---
 sbin/nvmecontrol/fabrics.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sbin/nvmecontrol/fabrics.c b/sbin/nvmecontrol/fabrics.c
index 6470e4062b39..c9aca088c47e 100644
--- a/sbin/nvmecontrol/fabrics.c
+++ b/sbin/nvmecontrol/fabrics.c
@@ -452,8 +452,8 @@ connect_nvm_queues(const struct nvmf_association_params 
*aparams,
 
        /* Validate I/O queue size. */
        if (queue_size == 0)
-               queue_size = mqes + 1;
-       else if (queue_size > mqes + 1) {
+               queue_size = (u_int)mqes + 1;
+       else if (queue_size > (u_int)mqes + 1) {
                shutdown_controller(*admin);
                nvmf_free_association(na);
                warn("I/O queue size exceeds controller maximum (%u)",

Reply via email to