nvmf/tcp: Using spdk_min instead of multi-lines codes.
We can use spdk_min to get the copy_len in spdk_nvmf_tcp_send_c2h_term_req. It confirms copy_len it's not larger than SPDK_NVME_TCP_TERM_REQ_ERROR_DATA_MAX_SIZE Signed-off-by: dongx.yi <dongx.yi@intel.com> Change-Id: Id343928e1911e4ab77fca7463f3f0cc55889db30 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479118 Community-CI: SPDK CI Jenkins <sys_sgci@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
1044fe25e6
commit
f7e8827aa6
@ -1252,10 +1252,7 @@ spdk_nvmf_tcp_send_c2h_term_req(struct spdk_nvmf_tcp_qpair *tqpair, struct nvme_
|
||||
DSET32(&c2h_term_req->fei, error_offset);
|
||||
}
|
||||
|
||||
copy_len = pdu->hdr->common.hlen;
|
||||
if (copy_len > SPDK_NVME_TCP_TERM_REQ_ERROR_DATA_MAX_SIZE) {
|
||||
copy_len = SPDK_NVME_TCP_TERM_REQ_ERROR_DATA_MAX_SIZE;
|
||||
}
|
||||
copy_len = spdk_min(pdu->hdr->common.hlen, SPDK_NVME_TCP_TERM_REQ_ERROR_DATA_MAX_SIZE);
|
||||
|
||||
/* Copy the error info into the buffer */
|
||||
memcpy((uint8_t *)rsp_pdu->hdr->raw + c2h_term_req_hdr_len, pdu->hdr->raw, copy_len);
|
||||
|
Loading…
Reference in New Issue
Block a user