nvmf_tcp: Correct tests for PDU direction

Add parentheses to ensure the correct order of operations.

Reported by:	GCC
This commit is contained in:
John Baldwin 2024-05-06 13:33:54 -07:00
parent e75a79f40b
commit a7db82cfd9
2 changed files with 2 additions and 2 deletions

View File

@ -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,

View File

@ -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);