From nobody Tue May 07 20:54:18 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VYr9k3BrCz5Jg6D; Tue, 07 May 2024 20:54:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VYr9k1WRVz55GR; Tue, 7 May 2024 20:54:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715115258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3xlpxWOWbsHfQtjYlHT9n1Y+K5Exl2V834/scMDkIEk=; b=wyE3ag3cZuUki4zn2RPITNxNiPdRh2KZJ5FjkSxIXWk5iGlRzojsm4dRFmZ73OthMMQvHa JzIf5VrwwmiY/MBHuQBXK3zzp/D2C00SlV+JXT58U1UQfsKA7bBoJk9qnOxIcagRtFhq5h fBB77Q121l86Wq3xifl/Haksk1WbU7kgvdHeMrtML5oFXGL1fssezpwT02+Hpw9YqzsPe9 GYZvR0xuahCalI5QHKgs4LGHZTK3fE+pLLnKd3umiTIysqPxW5xSpFrf+BQPa49PEM5x4L +2QGEuilEo+/o43c99AQOIKjMKTp5bFpfL+bb0l97hbGEcRsQ7J11Hf0hipCMA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715115258; a=rsa-sha256; cv=none; b=KoNjSk3Ik99YGESMVoNz1mnpt1e0Zz3GDnE26fauGDGkyHJ6o37PPCBpC9J6TiUUkfiYmL 4wp8JdogeRc0ikXoLEum37BQ1DMmmmHbToHegxjJW9F/FmjvcsJ87rFFdhHpjN9DoLhdUz u8n/70qri2ofyUHSYyom6mIVM0i1oySMzpCZBzW1tUnaU5jDMOg+1AxmViZT9M6J+Skm0f nUlJeNiHjNQ/Ld7hh6iXNzWvMyyVTx389hb7wAyR3IMQtdhG46EJK4dFUQJVfGnx0Wj12L 4g0TLCAXo86JJzV+CBGvTTdK0gSzjA3KhkGgugYU8l+zSiB8Kt/rls27U7sZ3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715115258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3xlpxWOWbsHfQtjYlHT9n1Y+K5Exl2V834/scMDkIEk=; b=PZQ+oQxyXVdhqkynvilQkVBtHpg1fI3u+OrUk1Z413l6A98CIN4VKc+D5TawxA4JkYCGNJ 7Ftxk71ETdeuacVtzsGGIwP5PMlwV8/y+m60+4x8C1PrwgjD4urKGPweLrFVT00GhxpO1f Yz9epCwLrOTbRawPfeYTRU/rPFXkcWmwwAB4vxqUDHCI1jpuV/g00ORSzuqTyu2GFBWdQZ zAP3S/7bH3dWqAcFfdOysUO9I/gBvGQEMhw0wQsGiJovLgClSc72ZTN3j+nIXA+mkgQr5t VD5mYJW7XdkchcEqPIPKp/0+9GLkyf9n6DIL80oxdLvVW2D5333z8cgIeKPIVw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VYr9k17F9zwmJ; Tue, 7 May 2024 20:54:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 447KsIld039860; Tue, 7 May 2024 20:54:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 447KsICc039857; Tue, 7 May 2024 20:54:18 GMT (envelope-from git) Date: Tue, 7 May 2024 20:54:18 GMT Message-Id: <202405072054.447KsICc039857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c8703409edb7 - main - nvmecontrol: Fix a sign compare mismatch List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8703409edb782b953b89d517a1757756788ce18 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c8703409edb782b953b89d517a1757756788ce18 commit c8703409edb782b953b89d517a1757756788ce18 Author: John Baldwin AuthorDate: 2024-05-07 20:45:51 +0000 Commit: John Baldwin 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)",