V2: add the assert codes.

Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Laszlo Ersek <ler...@redhat.com>
Cc: Liming Gao <liming....@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan...@intel.com>
---
 OvmfPkg/VirtioGpuDxe/Commands.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/VirtioGpuDxe/Commands.c b/OvmfPkg/VirtioGpuDxe/Commands.c
index b369dc3..962087c 100644
--- a/OvmfPkg/VirtioGpuDxe/Commands.c
+++ b/OvmfPkg/VirtioGpuDxe/Commands.c
@@ -282,16 +282,17 @@ VirtioGpuSendCommand (
   }
   Header->CtxId     = 0;
   Header->Padding   = 0;
 
   ASSERT (RequestSize >= sizeof *Header);
+  ASSERT (RequestSize <= MAX_UINT32);
 
   //
   // Compose the descriptor chain.
   //
   VirtioPrepare (&VgpuDev->Ring, &Indices);
-  VirtioAppendDesc (&VgpuDev->Ring, (UINTN)Header, RequestSize,
+  VirtioAppendDesc (&VgpuDev->Ring, (UINTN)Header, (UINT32)RequestSize,
     VRING_DESC_F_NEXT, &Indices);
   VirtioAppendDesc (&VgpuDev->Ring, (UINTN)&Response, sizeof Response,
     VRING_DESC_F_WRITE, &Indices);
 
   //
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to