Commit f8000963 authored by Sebastian Brzezinka's avatar Sebastian Brzezinka Committed by Tomasz Zawadzki
Browse files

nvmf/vfio_user: cast `numdw` to uint32_t



Use uint32_t to avoid overflow when left shift by 16 places

This patch fix issue #2858

Signed-off-by: default avatarSebastian Brzezinka <sebastian.brzezinka@intel.com>
Change-Id: I07f4328674ae7bd7525792ca1e424e85a932c87f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16180


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent 58396fb1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -5367,7 +5367,8 @@ map_admin_cmd_req(struct nvmf_vfio_user_ctrlr *ctrlr, struct spdk_nvmf_request *
		len = 4096;
		break;
	case SPDK_NVME_OPC_GET_LOG_PAGE:
		numdw = (((cmd->cdw11_bits.get_log_page.numdu << 16) | cmd->cdw10_bits.get_log_page.numdl) + 1);
		numdw = ((((uint32_t)cmd->cdw11_bits.get_log_page.numdu << 16) |
			  cmd->cdw10_bits.get_log_page.numdl) + 1);
		if (numdw > UINT32_MAX / 4) {
			return -EINVAL;
		}