From nobody Mon May 06 21:04:02 2024 X-Original-To: dev-commits-src-all@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 4VYDRR1JNXz5JKYq; Mon, 06 May 2024 21:04:03 +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 4VYDRR03Y4z4JKZ; Mon, 6 May 2024 21:04:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715029443; 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=toBOKk9dgZ1ugqH3gavWvEwlbIU1XKaOjECT+pFzHU0=; b=KCyGsl2++za/2jNTfrDD//BJsePwhYkVCJ2ssiyvlrbYtO9JyZJDXLQUvvhDnl5tvWvOKr uc7XqV/eRdccsHkPyP6/8/MgyKKfD9eKeIFbLbV7BuHD+/eqGEsDIko+2BcLbPzU8I/F7x NJBD0RQRUIO2qClH5IXoqvHfPQR9layTzzOLbyEMSCPjnDDGUjkjjgJqGtvmMNPoOYMmOJ +zcFepzdWvk1VVQwO0+kU6l9lcwWkT+oi6KPMovyQ+/52TfKBuvJhwUwVMuQEd0zsqBHfQ P0O7L3yE4DyKVYJIZnBNrhdfogEqANmQ1Nx6Xa/wRDSEjt5b7DERE2XDZJvqAw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715029443; a=rsa-sha256; cv=none; b=TR2l37T5H42+3jFj0ibRXsPdqv7oG4cvQ5ybyhOiWuowFxFmy8NAxQMmASJGzGjdIAlG9E OKUfWYr0dmHd4psxkw6/yPU+UOcQF2vHg3RqjYSiCw8RFCrO5afHoopYq4MDZZADmilwT/ glfG+PsgqRiUUJSLOL0Dsx7fTaWH4mJLrKgs35p+2aAzjOQeyvRB6Kz/j8TCLIU+Zk6pY9 qafvBES+SGGqk4/tGx5zKzN3Mu9d1XejfsaZrwoLcG9reruvFIQckT4SS1IUZCYLyO1iRg +x7xjzxpyS/86rJSnVhzpg1NJPzRP7Wa1PnpJlmvSD33idnEEzz8M/uoOZHKfg== 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=1715029443; 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=toBOKk9dgZ1ugqH3gavWvEwlbIU1XKaOjECT+pFzHU0=; b=U7uapZrACdMxUIjwJL6gXzldMbtWn21pLsb1jGjgVRVVDdFdYvBXCtBd1+r6VNuC+AyQpy CGnTFg0/ALqoM2UoTn7uCkdFz2rCXlVYjvChCi76e9ptFZLFeKjDk9QsR5Xo3G2NlDYvYu BsqJr1ego0k04y9bEKxD/21vxV7IYZpvX/0HjLIY69Q4/usyyELZOBTvHweBlLXImsCaJE 0cK1Tfoj2+89x2RZlserV+xj+ehNgyi1JwYgE0Z8XHIEYwcZCmHA6PEhxypZHCz9XRY198 91jErq+uBQ7wAHYmffZwr4nk1z3VWsH4wKvZK9CNoudXyRxJ8uQsRLxk+CfgRQ== 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 4VYDRQ6mQBz1CVZ; Mon, 6 May 2024 21:04:02 +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 446L42RF016520; Mon, 6 May 2024 21:04:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 446L42ql016517; Mon, 6 May 2024 21:04:02 GMT (envelope-from git) Date: Mon, 6 May 2024 21:04:02 GMT Message-Id: <202405062104.446L42ql016517@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: a7db82cfd940 - main - nvmf_tcp: Correct tests for PDU direction List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: a7db82cfd940431037e748280825931a46ed2d12 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a7db82cfd940431037e748280825931a46ed2d12 commit a7db82cfd940431037e748280825931a46ed2d12 Author: John Baldwin AuthorDate: 2024-05-06 20:33:54 +0000 Commit: John Baldwin CommitDate: 2024-05-06 21:03:48 +0000 nvmf_tcp: Correct tests for PDU direction Add parentheses to ensure the correct order of operations. Reported by: GCC --- lib/libnvmf/nvmf_tcp.c | 2 +- sys/dev/nvmf/nvmf_tcp.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libnvmf/nvmf_tcp.c b/lib/libnvmf/nvmf_tcp.c index 12da329f34b4..b9bf8153ab1b 100644 --- a/lib/libnvmf/nvmf_tcp.c +++ b/lib/libnvmf/nvmf_tcp.c @@ -803,7 +803,7 @@ nvmf_tcp_validate_ic_pdu(struct nvmf_association *na, struct nvmf_tcp_qpair *qp, /* Validate pdu_type. */ /* Controllers only receive PDUs with a PDU direction of 0. */ - if (na->na_controller != (ch->pdu_type & 0x01) == 0) { + if (na->na_controller != ((ch->pdu_type & 0x01) == 0)) { na_error(na, "NVMe/TCP: Invalid PDU type %u", ch->pdu_type); nvmf_tcp_report_error(na, qp, NVME_TCP_TERM_REQ_FES_INVALID_HEADER_FIELD, 0, ch, pdu_len, diff --git a/sys/dev/nvmf/nvmf_tcp.h b/sys/dev/nvmf/nvmf_tcp.h index 00b0917f75a4..78d6cf17a977 100644 --- a/sys/dev/nvmf/nvmf_tcp.h +++ b/sys/dev/nvmf/nvmf_tcp.h @@ -50,7 +50,7 @@ nvmf_tcp_validate_pdu_header(const struct nvme_tcp_common_pdu_hdr *ch, /* Validate pdu_type. */ /* Controllers only receive PDUs with a PDU direction of 0. */ - if (controller != (ch->pdu_type & 0x01) == 0) { + if (controller != ((ch->pdu_type & 0x01) == 0)) { printf("NVMe/TCP: Invalid PDU type %u\n", ch->pdu_type); *fes = NVME_TCP_TERM_REQ_FES_INVALID_HEADER_FIELD; *fei = offsetof(struct nvme_tcp_common_pdu_hdr, pdu_type);