]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c
IntelFrameworkModulePkg: Refine casting expression result to bigger size
[mirror_edk2.git] / IntelFrameworkModulePkg / Csm / LegacyBiosDxe / LegacyBios.c
index 452487b66c3c6e0f5b6a1113370bbd3479b32f58..3ead2d98280929b0192ecf1222c02f9023db9fd2 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -144,7 +144,7 @@ LegacyBiosGetLegacyRegion (
      );\r
 \r
   if (Regs.X.AX == 0) {\r
-    *LegacyMemoryAddress  = (VOID *) (UINTN) ((Regs.X.DS << 4) + Regs.X.BX);\r
+    *LegacyMemoryAddress  = (VOID *) (((UINTN) Regs.X.DS << 4) + Regs.X.BX);\r
     Status = EFI_SUCCESS;\r
   } else {\r
     Status = EFI_OUT_OF_RESOURCES;\r
@@ -699,7 +699,7 @@ InstallSmbiosEventCallback (
             &gEfiSmbiosTableGuid,\r
             &mRuntimeSmbiosEntryPoint\r
             );\r
-  if (EFI_ERROR (Status)) {\r
+  if ((EFI_ERROR (Status)) || (mRuntimeSmbiosEntryPoint == NULL)) {\r
     return;\r
   }\r
   \r
@@ -728,7 +728,7 @@ InstallSmbiosEventCallback (
   }\r
   \r
   if ((mStructureTableAddress != 0) && \r
-      (mStructureTablePages < (UINTN) EFI_SIZE_TO_PAGES (EntryPointStructure->TableLength))) {\r
+      (mStructureTablePages < EFI_SIZE_TO_PAGES ((UINT32)EntryPointStructure->TableLength))) {\r
     //\r
     // If original buffer is not enough for the new SMBIOS table, free original buffer and re-allocate\r
     //\r
@@ -1005,10 +1005,10 @@ LegacyBiosInstall (
                AllocateAddress,\r
                MemStart,\r
                1,\r
-               &MemoryAddress\r
+               &StartAddress\r
                );\r
     if (!EFI_ERROR (Status)) {\r
-      MemoryPtr = (VOID *) ((UINTN) MemoryAddress);\r
+      MemoryPtr = (VOID *) ((UINTN) StartAddress);\r
       ZeroMem (MemoryPtr, 0x1000);\r
     } else {\r
       DEBUG ((EFI_D_ERROR, "WARNING: Allocate legacy memory fail for SCSI card - %x\n", MemStart));\r