]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1) Add type cast for better coding style.
authorFeng Tian <feng.tian@intel.com>
Thu, 7 Aug 2014 08:54:34 +0000 (08:54 +0000)
committererictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 7 Aug 2014 08:54:34 +0000 (08:54 +0000)
2) replace StrCpy() usage in Variable driver with StrnCpy().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15770 6f19259b-4bc3-4df7-8a09-765794883524

28 files changed:
MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c
MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c
MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
MdeModulePkg/Core/Dxe/Event/Event.c
MdeModulePkg/Core/Dxe/Mem/Page.c
MdeModulePkg/Core/Dxe/Mem/Pool.c
MdeModulePkg/Core/PiSmmCore/Dispatcher.c
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c
MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptExecute.c
MdeModulePkg/Universal/Acpi/AcpiTableDxe/Aml.c
MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c
MdeModulePkg/Universal/EbcDxe/EbcExecute.c
MdeModulePkg/Universal/EbcDxe/Ia32/EbcSupport.c
MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c
MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
MdeModulePkg/Universal/HiiDatabaseDxe/String.c
MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c

index 12a40d413e09ead34287172ef4fea145c53d418d..6ccf0a3f014995545d08875f8f87247b5c1a93f4 100644 (file)
@@ -717,7 +717,7 @@ AtaAtapiPassThruStart (
                     &Supports\r
                     );\r
   if (!EFI_ERROR (Status)) {\r
-    Supports &= EFI_PCI_DEVICE_ENABLE;\r
+    Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;\r
     Status = PciIo->Attributes (\r
                       PciIo,\r
                       EfiPciIoAttributeOperationEnable,\r
@@ -951,7 +951,7 @@ AtaAtapiPassThruStop (
                     &Supports\r
                     );\r
   if (!EFI_ERROR (Status)) {\r
-    Supports &= EFI_PCI_DEVICE_ENABLE;\r
+    Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;\r
     PciIo->Attributes (\r
              PciIo,\r
              EfiPciIoAttributeOperationDisable,\r
index 603d367ec5aa85d0d2f6489fb5bb121e8801c5f8..3fcb0f9914b3292878621ae3f8be8843882fea8d 100644 (file)
@@ -11,7 +11,7 @@
   and companion host controller when UHCI or OHCI gets attached earlier than EHCI and a \r
   USB 2.0 device inserts.\r
 \r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1754,7 +1754,7 @@ EhcDriverBindingStart (
                     &Supports\r
                     );\r
   if (!EFI_ERROR (Status)) {\r
-    Supports &= EFI_PCI_DEVICE_ENABLE;\r
+    Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;\r
     Status = PciIo->Attributes (\r
                       PciIo,\r
                       EfiPciIoAttributeOperationEnable,\r
index 8848d1a2a98dc8fc4170570cad47d595c4a6ff8f..ac09fc2bd82f70ef51ee97b11f7d8e65656471b9 100644 (file)
@@ -816,7 +816,7 @@ NvmeControllerInit (
                     );\r
 \r
   if (!EFI_ERROR (Status)) {\r
-    Supports &= EFI_PCI_DEVICE_ENABLE;\r
+    Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;\r
     Status    = PciIo->Attributes (\r
                          PciIo,\r
                          EfiPciIoAttributeOperationEnable,\r
index 0ff39a56c4ceb63884aea80add915476a17be213..5ace222e602886df5eb8f3fceec17038ad9c1704 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Supporting functions implementaion for PCI devices management.\r
 \r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -705,7 +705,7 @@ StartPciDevicesOnBridge (
                              0,\r
                              &Supports\r
                              );\r
-        Supports &= EFI_PCI_DEVICE_ENABLE;\r
+        Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;\r
         PciIoDevice->PciIo.Attributes (\r
                              &(PciIoDevice->PciIo),\r
                              EfiPciIoAttributeOperationEnable,\r
@@ -757,7 +757,7 @@ StartPciDevicesOnBridge (
                              0,\r
                              &Supports\r
                              );\r
-        Supports &= EFI_PCI_DEVICE_ENABLE;\r
+        Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;\r
         PciIoDevice->PciIo.Attributes (\r
                              &(PciIoDevice->PciIo),\r
                              EfiPciIoAttributeOperationEnable,\r
index 26c9a33854abe33b9a25c304b102abe38dba2516..9e7ac74eb70c331f56c57f035953435fce8b877f 100644 (file)
@@ -947,12 +947,12 @@ PciSetDeviceAttribute (
 \r
   if (Option == EFI_SET_SUPPORTS) {\r
 \r
-    Attributes |= EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE |\r
+    Attributes |= (UINT64) (EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE |\r
                   EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED        |\r
                   EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE       |\r
                   EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE      |\r
                   EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM         |\r
-                  EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE;\r
+                  EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE);\r
 \r
     if (IS_PCI_LPC (&PciIoDevice->Pci)) {\r
         Attributes |= EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO;\r
@@ -1120,7 +1120,7 @@ DetermineDeviceAttribute (
     //\r
     // Assume the PCI Root Bridge supports DAC\r
     //\r
-    PciIoDevice->Supports |= (EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE |\r
+    PciIoDevice->Supports |= (UINT64)(EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE |\r
                               EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM |\r
                               EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE);\r
 \r
index 2893f44d53c059384cfd2af3a3bbdd0768a3679f..15d6443fd34784019459a9e489174d7c2ac09131 100644 (file)
@@ -1448,7 +1448,7 @@ SupportPaletteSnoopAttributes (
     //\r
     if (Operation == EfiPciIoAttributeOperationEnable) {\r
       PCI_DISABLE_COMMAND_REGISTER (Temp, EFI_PCI_COMMAND_VGA_PALETTE_SNOOP);\r
-      Temp->Attributes &= (~EFI_PCI_COMMAND_VGA_PALETTE_SNOOP);\r
+      Temp->Attributes &= (~(UINT64)EFI_PCI_COMMAND_VGA_PALETTE_SNOOP);\r
     } else {\r
       return EFI_UNSUPPORTED;\r
     }\r
index 1c8ff0bc5b4f457b06ba21ca75cc6e2f62d1af3a..34471ab9211e398e9154fc6046d9339159620c06 100644 (file)
@@ -2,7 +2,7 @@
 \r
   The UHCI driver model and HC protocol routines.\r
 \r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1704,7 +1704,7 @@ UhciDriverBindingStart (
                     &Supports\r
                     );\r
   if (!EFI_ERROR (Status)) {\r
-    Supports &= EFI_PCI_DEVICE_ENABLE;\r
+    Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;\r
     Status = PciIo->Attributes (\r
                       PciIo,\r
                       EfiPciIoAttributeOperationEnable,\r
index 736c57a667860c71d9ba335bbeafeef071fc4144..3224202bfe45c8d2cf6b4bfbc3699e8fd87a48f4 100644 (file)
@@ -1969,7 +1969,7 @@ XhcDriverBindingStart (
                     &Supports\r
                     );\r
   if (!EFI_ERROR (Status)) {\r
-    Supports &= EFI_PCI_DEVICE_ENABLE;\r
+    Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;\r
     Status = PciIo->Attributes (\r
                       PciIo,\r
                       EfiPciIoAttributeOperationEnable,\r
index 370d9b81b25dececea36099668bedccbd92d8174..e29e727e3c20be0acac08b01dcae8262abd9930c 100644 (file)
@@ -2658,8 +2658,8 @@ XhcInitializeEndpointContext (
                 ((TRANSFER_RING *)(UINTN)Xhc->UsbDevContext[SlotId].EndpointTransferRing[Dci-1])->RingSeg0,\r
                 sizeof (TRB_TEMPLATE) * TR_RING_TRB_NUMBER\r
                 );\r
-    PhyAddr &= ~(0x0F);\r
-    PhyAddr |= ((TRANSFER_RING *)(UINTN)Xhc->UsbDevContext[SlotId].EndpointTransferRing[Dci-1])->RingPCS;\r
+    PhyAddr &= ~((EFI_PHYSICAL_ADDRESS)0x0F);\r
+    PhyAddr |= (EFI_PHYSICAL_ADDRESS)((TRANSFER_RING *)(UINTN)Xhc->UsbDevContext[SlotId].EndpointTransferRing[Dci-1])->RingPCS;\r
     InputContext->EP[Dci-1].PtrLo = XHC_LOW_32BIT (PhyAddr);\r
     InputContext->EP[Dci-1].PtrHi = XHC_HIGH_32BIT (PhyAddr);\r
 \r
@@ -2811,8 +2811,8 @@ XhcInitializeEndpointContext64 (
                 ((TRANSFER_RING *)(UINTN)Xhc->UsbDevContext[SlotId].EndpointTransferRing[Dci-1])->RingSeg0,\r
                 sizeof (TRB_TEMPLATE) * TR_RING_TRB_NUMBER\r
                 );\r
-    PhyAddr &= ~(0x0F);\r
-    PhyAddr |= ((TRANSFER_RING *)(UINTN)Xhc->UsbDevContext[SlotId].EndpointTransferRing[Dci-1])->RingPCS;\r
+    PhyAddr &= ~((EFI_PHYSICAL_ADDRESS)0x0F);\r
+    PhyAddr |= (EFI_PHYSICAL_ADDRESS)((TRANSFER_RING *)(UINTN)Xhc->UsbDevContext[SlotId].EndpointTransferRing[Dci-1])->RingPCS;\r
     InputContext->EP[Dci-1].PtrLo = XHC_LOW_32BIT (PhyAddr);\r
     InputContext->EP[Dci-1].PtrHi = XHC_HIGH_32BIT (PhyAddr);\r
 \r
index aedc2e8dc04b78e61c47df4a65fae3731e5be702..dde31e0f1a580f294a14835f1f96894677b70885 100644 (file)
@@ -1754,8 +1754,8 @@ XhcPeiSetConfigCmd (
                   ((TRANSFER_RING *) (UINTN) Xhc->UsbDevContext[SlotId].EndpointTransferRing[Dci-1])->RingSeg0,\r
                   sizeof (TRB_TEMPLATE) * TR_RING_TRB_NUMBER\r
                   );\r
-      PhyAddr &= ~(0x0F);\r
-      PhyAddr |= ((TRANSFER_RING *) (UINTN) Xhc->UsbDevContext[SlotId].EndpointTransferRing[Dci-1])->RingPCS;\r
+      PhyAddr &= ~((EFI_PHYSICAL_ADDRESS)0x0F);\r
+      PhyAddr |= (EFI_PHYSICAL_ADDRESS)((TRANSFER_RING *) (UINTN) Xhc->UsbDevContext[SlotId].EndpointTransferRing[Dci-1])->RingPCS;\r
       InputContext->EP[Dci-1].PtrLo = XHC_LOW_32BIT (PhyAddr);\r
       InputContext->EP[Dci-1].PtrHi = XHC_HIGH_32BIT (PhyAddr);\r
 \r
@@ -1948,8 +1948,8 @@ XhcPeiSetConfigCmd64 (
                   sizeof (TRB_TEMPLATE) * TR_RING_TRB_NUMBER\r
                   );\r
 \r
-      PhyAddr &= ~(0x0F);\r
-      PhyAddr |= ((TRANSFER_RING *) (UINTN) Xhc->UsbDevContext[SlotId].EndpointTransferRing[Dci-1])->RingPCS;\r
+      PhyAddr &= ~((EFI_PHYSICAL_ADDRESS)0x0F);\r
+      PhyAddr |= (EFI_PHYSICAL_ADDRESS)((TRANSFER_RING *) (UINTN) Xhc->UsbDevContext[SlotId].EndpointTransferRing[Dci-1])->RingPCS;\r
 \r
       InputContext->EP[Dci-1].PtrLo = XHC_LOW_32BIT (PhyAddr);\r
       InputContext->EP[Dci-1].PtrHi = XHC_HIGH_32BIT (PhyAddr);\r
index 31003a2a566c73eba695c1527a4e2e1a42765824..a8c4c34d83c9f0a98a6ab655b75db48eea9346cd 100644 (file)
@@ -204,7 +204,7 @@ CoreDispatchEventNotifies (
     CoreAcquireEventLock ();\r
   }\r
 \r
-  gEventPending &= ~(1 << Priority);\r
+  gEventPending &= ~(UINTN)(1 << Priority);\r
   CoreReleaseEventLock ();\r
 }\r
 \r
index 90976a1f0f33f397455797c75b929679de0eaed4..f5067f663eae8dd0b7c535e4b2c439176f3fd655 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   UEFI Memory page management functions.\r
 \r
-Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -930,7 +930,7 @@ CoreFindFreePagesI (
     //\r
     // Set MaxAddress to a page boundary\r
     //\r
-    MaxAddress &= ~EFI_PAGE_MASK;\r
+    MaxAddress &= ~(UINT64)EFI_PAGE_MASK;\r
 \r
     //\r
     // Set MaxAddress to end of the page\r
index bc785a8b9c85cd624b51152acf768f10e303ead8..7d250980f03b93b1116d35a68ec9cc637f6c6c1a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   UEFI Memory pool management functions.\r
 \r
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -274,7 +274,7 @@ CoreAllocatePoolI (
   //\r
   if (Index >= MAX_POOL_LIST) {\r
     NoPages = EFI_SIZE_TO_PAGES(Size) + EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1;\r
-    NoPages &= ~(EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1);\r
+    NoPages &= ~(UINTN)(EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1);\r
     Head = CoreAllocatePoolPages (PoolType, NoPages, DEFAULT_PAGE_ALLOCATION);\r
     goto Done;\r
   }\r
@@ -473,7 +473,7 @@ CoreFreePoolI (
     // Return the memory pages back to free memory\r
     //\r
     NoPages = EFI_SIZE_TO_PAGES(Size) + EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1;\r
-    NoPages &= ~(EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1);\r
+    NoPages &= ~(UINTN)(EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1);\r
     CoreFreePoolPages ((EFI_PHYSICAL_ADDRESS) (UINTN) Head, NoPages);\r
 \r
   } else {\r
index 753122ef5afbc8f4e64d032ab63ac9112486a0a2..a4686306f6e2de9bde78f69cb87806cb6048c437 100644 (file)
@@ -519,7 +519,7 @@ SmmLoadImage (
   // Align buffer on section boundry\r
   //\r
   ImageContext.ImageAddress += ImageContext.SectionAlignment - 1;\r
-  ImageContext.ImageAddress &= ~(ImageContext.SectionAlignment - 1);\r
+  ImageContext.ImageAddress &= ~((EFI_PHYSICAL_ADDRESS)(ImageContext.SectionAlignment - 1));\r
 \r
   //\r
   // Load the image to our new buffer\r
index 86adb1349d5e7f80dea148acd4a545c2d79f9054..b0e387401c9fc7b1d1faa75df1baa0028a754497 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   SMM IPL that produces SMM related runtime protocols and load the SMM Core into SMRAM\r
 \r
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available \r
   under the terms and conditions of the BSD License which accompanies this \r
   distribution.  The full text of the license may be found at        \r
@@ -952,7 +952,7 @@ ExecuteSmmCoreFromSmram (
   }\r
   \r
   ImageContext.ImageAddress += ImageContext.SectionAlignment - 1;\r
-  ImageContext.ImageAddress &= ~(ImageContext.SectionAlignment - 1);\r
+  ImageContext.ImageAddress &= ~((EFI_PHYSICAL_ADDRESS)(ImageContext.SectionAlignment - 1));\r
 \r
   //\r
   // Print debug message showing SMM Core load address.\r
index fd20e1c258db28a2e4585a8a77c6d98e0939cb54..2fc6031ab74d1eb0e38e08c03343fa7c4fa8dfe8 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   16550 UART Serial Port library functions\r
 \r
-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -177,7 +177,7 @@ SerialPortInitialize (
   }\r
   SerialPortWriteRegister (R_UART_LCR, (UINT8)(SerialPortReadRegister (R_UART_LCR) | B_UART_LCR_DLAB));\r
   Divisor =  SerialPortReadRegister (R_UART_BAUD_HIGH) << 8;\r
-  Divisor |= SerialPortReadRegister (R_UART_BAUD_LOW);\r
+  Divisor |= (UINTN)SerialPortReadRegister (R_UART_BAUD_LOW);\r
   SerialPortWriteRegister (R_UART_LCR, (UINT8)(SerialPortReadRegister (R_UART_LCR) & ~B_UART_LCR_DLAB));\r
   if (Divisor != 115200 / PcdGet32 (PcdSerialBaudRate)) {\r
     Initialized = FALSE;\r
index c0750ad1767bb7559b3e4d2d1d757bc6beae35aa..caff0409993091f36ac46c80dea10f711aa30225 100644 (file)
@@ -6,7 +6,7 @@
   protocol related to this implementation, not in the public spec. So, this \r
   library instance is only for this code base.\r
 \r
-Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1235,7 +1235,7 @@ InternalPrintLibSPrintMarker (
     //\r
     // Clear all the flag bits except those that may have been passed in\r
     //\r
-    Flags &= (OUTPUT_UNICODE | FORMAT_UNICODE | COUNT_ONLY_NO_PRINT);\r
+    Flags &= (UINTN)(OUTPUT_UNICODE | FORMAT_UNICODE | COUNT_ONLY_NO_PRINT);\r
 \r
     //\r
     // Set the default width to zero, and the default precision to 1\r
@@ -1343,7 +1343,7 @@ InternalPrintLibSPrintMarker (
         //\r
         // Flag space, +, 0, L & l are invalid for type p.\r
         //\r
-        Flags &= ~(PREFIX_BLANK | PREFIX_SIGN | PREFIX_ZERO | LONG_TYPE);\r
+        Flags &= ~(UINTN)(PREFIX_BLANK | PREFIX_SIGN | PREFIX_ZERO | LONG_TYPE);\r
         if (sizeof (VOID *) > 4) {\r
           Flags |= LONG_TYPE;\r
         }\r
@@ -1391,7 +1391,7 @@ InternalPrintLibSPrintMarker (
         if ((Flags & RADIX_HEX) == 0) {\r
           Radix = 10;\r
           if (Comma) {\r
-            Flags &= (~PREFIX_ZERO);\r
+            Flags &= (~(UINTN)PREFIX_ZERO);\r
             Precision = 1;\r
           }\r
           if (Value < 0) {\r
@@ -1460,7 +1460,7 @@ InternalPrintLibSPrintMarker (
           ArgumentString = BASE_ARG (BaseListMarker, CHAR8 *);\r
         }\r
         if (ArgumentString == NULL) {\r
-          Flags &= (~ARGUMENT_UNICODE);\r
+          Flags &= (~(UINTN)ARGUMENT_UNICODE);\r
           ArgumentString = "<null string>";\r
         }\r
         //\r
index cba331a3bda30d41dc5ef231c4838a64a58d528e..c32685984e22c2fe357907bc87ce18819e76cce4 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Interpret and execute the S3 data in S3 boot script. \r
 \r
-  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2014, 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
@@ -1312,7 +1312,7 @@ CheckAndOrMask (
 \r
   switch (ScriptHeader->Width) {\r
   case S3BootScriptWidthUint8:\r
-    *AndMask  = (UINT64) *(DataPtr + 1);\r
+    *AndMask  = (UINT64) (*(UINT8*) (DataPtr + 1));\r
     *OrMask   = (UINT64) (*DataPtr);\r
     break;\r
 \r
index a7b53e27bd2e33a6254cd98d22617bf82d34b9bb..30f71bdda45c25f2f264251cdb4f1d0208a76a67 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   ACPI Sdt Protocol Driver\r
 \r
-  Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved. <BR>\r
+  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved. <BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -282,13 +282,13 @@ AmlGetPkgLength (
     break;\r
   case 2:\r
     RealLength = *(Buffer + 1);\r
-    RealLength |= (*(Buffer + 2)) << 8;\r
+    RealLength |= (UINTN)((*(Buffer + 2)) << 8);\r
     RealLength = (RealLength << 4) | (LeadByte & 0xF);\r
     break;\r
   case 3:\r
     RealLength = *(Buffer + 1);\r
-    RealLength |= (*(Buffer + 2)) << 8;\r
-    RealLength |= (*(Buffer + 3)) << 16;\r
+    RealLength |= (UINTN)((*(Buffer + 2)) << 8);\r
+    RealLength |= (UINTN)((*(Buffer + 3)) << 16);\r
     RealLength = (RealLength << 4) | (LeadByte & 0xF);\r
     break;\r
   default:\r
index ab185874c0e53b4d3398753e40cb8bc36a350698..6c1c304a150d5efd10bd5e4273c5ad169d1a1a3b 100644 (file)
@@ -4,7 +4,7 @@
   This driver is dispatched by Dxe core and the driver will reload itself to ACPI reserved memory\r
   in the entry point. The functionality is to interpret and restore the S3 boot script\r
 \r
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, 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 of the BSD License\r
@@ -280,7 +280,7 @@ ReadyToLockEventNotify (
   // Align buffer on section boundry\r
   //\r
   ImageContext.ImageAddress += ImageContext.SectionAlignment - 1;\r
-  ImageContext.ImageAddress &= ~(ImageContext.SectionAlignment - 1);\r
+  ImageContext.ImageAddress &= ~((EFI_PHYSICAL_ADDRESS)(ImageContext.SectionAlignment - 1));\r
   //\r
   // Load the image to our new buffer\r
   //\r
index 69aee07ea9f3414b1d43333c92726ff2a7de8cee..433eea250f7f5e0d650584bcee3dc59e1c0a39ac 100644 (file)
@@ -3269,7 +3269,7 @@ ExecuteCMP (
   if (Flag != 0) {\r
     VMFLAG_SET (VmPtr, VMFLAGS_CC);\r
   } else {\r
-    VMFLAG_CLEAR (VmPtr, VMFLAGS_CC);\r
+    VMFLAG_CLEAR (VmPtr, (UINT64)VMFLAGS_CC);\r
   }\r
   //\r
   // Advance the IP\r
@@ -3448,7 +3448,7 @@ ExecuteCMPI (
   if (Flag != 0) {\r
     VMFLAG_SET (VmPtr, VMFLAGS_CC);\r
   } else {\r
-    VMFLAG_CLEAR (VmPtr, VMFLAGS_CC);\r
+    VMFLAG_CLEAR (VmPtr, (UINT64)VMFLAGS_CC);\r
   }\r
   //\r
   // Advance the IP\r
index 41dc3a858556164f0f5d16c874d0d2a7425be9d1..bddfbf630d7303353f834f456c373bea03b9f999 100644 (file)
@@ -2,7 +2,7 @@
   This module contains EBC support routines that are customized based on\r
   the target ia32 processor.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -267,7 +267,7 @@ EbcInterpret (
   VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);\r
   VmContext.Gpr[0] = (UINT64)(UINTN) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);\r
   VmContext.HighStackBottom = (UINTN)VmContext.Gpr[0];\r
-  VmContext.Gpr[0] &= ~(sizeof (UINTN) - 1);\r
+  VmContext.Gpr[0] &= ~((VM_REGISTER)(sizeof (UINTN) - 1));\r
   VmContext.Gpr[0] -= sizeof (UINTN);\r
 \r
   //\r
index 3f99a1a6e296776bd18999c3697d97960a9539c3..bdde5e41fad80d7f7730d85638013f0872d6f2b3 100644 (file)
@@ -2,7 +2,7 @@
   This module contains EBC support routines that are customized based on\r
   the target x64 processor.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -215,7 +215,7 @@ EbcInterpret (
   //\r
   // Align the stack on a natural boundary.\r
   //\r
-  VmContext.Gpr[0] &= ~(sizeof (UINTN) - 1);\r
+  VmContext.Gpr[0] &= ~(VM_REGISTER)(sizeof (UINTN) - 1);\r
 \r
   //\r
   // Put a magic value in the stack gap, then adjust down again.\r
@@ -359,7 +359,7 @@ ExecuteEbcImageEntryPoint (
 \r
   //\r
   // Align the stack on a natural boundary\r
-  VmContext.Gpr[0] &= ~(sizeof(UINTN) - 1);\r
+  VmContext.Gpr[0] &= ~(VM_REGISTER)(sizeof(UINTN) - 1);\r
   //\r
   VmContext.LowStackTop   = (UINTN) VmContext.Gpr[0];\r
 \r
index eef31d5bb833b94529234a0d81d8ddd8ea59522a..6cc350c42d9c904e133b9a23a5b3ad43d744f571 100644 (file)
@@ -757,12 +757,12 @@ FindGlyphBlock (
       break;\r
 \r
     case EFI_HII_GIBT_EXT1:\r
-      BlockPtr += *(BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8));\r
+      BlockPtr += *(UINT8*)((UINTN)BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8));\r
       break;\r
     case EFI_HII_GIBT_EXT2:\r
       CopyMem (\r
         &Length16,\r
-        BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8),\r
+        (UINT8*)((UINTN)BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8)),\r
         sizeof (UINT16)\r
         );\r
       BlockPtr += Length16;\r
@@ -770,7 +770,7 @@ FindGlyphBlock (
     case EFI_HII_GIBT_EXT4:\r
       CopyMem (\r
         &Length32,\r
-        BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8),\r
+        (UINT8*)((UINTN)BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8)),\r
         sizeof (UINT32)\r
         );\r
       BlockPtr += Length32;\r
@@ -793,7 +793,7 @@ FindGlyphBlock (
       BufferLen = BITMAP_LEN_1_BIT (LocalCell.Width, LocalCell.Height);\r
       if (CharCurrent == CharValue) {\r
         return WriteOutputParam (\r
-                 BlockPtr + sizeof (EFI_HII_GIBT_GLYPH_BLOCK) - sizeof (UINT8),\r
+                 (UINT8*)((UINTN)BlockPtr + sizeof (EFI_HII_GIBT_GLYPH_BLOCK) - sizeof (UINT8)),\r
                  BufferLen,\r
                  &LocalCell,\r
                  GlyphBuffer,\r
index ed0cf83c483df72df9eb348dedb5880111f858cf..560cf8fe2cffbc60166ea201b4d693cfce3a2c64 100644 (file)
@@ -79,13 +79,13 @@ GetImageIdOrAddress (
     }\r
     switch (((EFI_HII_IMAGE_BLOCK *) ImageBlock)->BlockType) {\r
     case EFI_HII_IIBT_EXT1:\r
-      Length8 = *(ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8));\r
+      Length8 = *(UINT8*)((UINTN)ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8));\r
       ImageBlock += Length8;\r
       break;\r
     case EFI_HII_IIBT_EXT2:\r
       CopyMem (\r
         &Length16,\r
-        ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8),\r
+        (UINT8*)((UINTN)ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8)),\r
         sizeof (UINT16)\r
         );\r
       ImageBlock += Length16;\r
@@ -93,7 +93,7 @@ GetImageIdOrAddress (
     case EFI_HII_IIBT_EXT4:\r
       CopyMem (\r
         &Length32,\r
-        ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8),\r
+        (UINT8*)((UINTN)ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8)),\r
         sizeof (UINT32)\r
         );\r
       ImageBlock += Length32;\r
@@ -920,19 +920,19 @@ HiiGetImage (
     if (BlockType == EFI_HII_IIBT_IMAGE_1BIT || BlockType == EFI_HII_IIBT_IMAGE_1BIT_TRANS) {\r
       Output1bitPixel (\r
         Image,\r
-        (UINT8 *) (ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_1BIT_BLOCK) - sizeof (UINT8)),\r
+        (UINT8 *) ((UINTN)ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_1BIT_BLOCK) - sizeof (UINT8)),\r
         (EFI_HII_IMAGE_PALETTE_INFO *) PaletteInfo\r
         );\r
     } else if (BlockType == EFI_HII_IIBT_IMAGE_4BIT || BlockType == EFI_HII_IIBT_IMAGE_4BIT_TRANS) {\r
       Output4bitPixel (\r
         Image,\r
-        (UINT8 *) (ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_4BIT_BLOCK) - sizeof (UINT8)),\r
+        (UINT8 *) ((UINTN)ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_4BIT_BLOCK) - sizeof (UINT8)),\r
         (EFI_HII_IMAGE_PALETTE_INFO *) PaletteInfo\r
         );\r
     } else {\r
       Output8bitPixel (\r
         Image,\r
-        (UINT8 *) (ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_8BIT_BLOCK) - sizeof (UINT8)),\r
+        (UINT8 *) ((UINTN)ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_8BIT_BLOCK) - sizeof (UINT8)),\r
         (EFI_HII_IMAGE_PALETTE_INFO *) PaletteInfo\r
         );\r
     }\r
index f3c0555cbcb5fba5e83888c1cab2107386dd22c7..1f4be0c40504a502477908e60d701bf6e03af255 100644 (file)
@@ -2,7 +2,7 @@
 Implementation for EFI_HII_STRING_PROTOCOL.\r
 \r
 \r
-Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -335,7 +335,7 @@ FindStringBlock (
 \r
     case EFI_HII_SIBT_STRINGS_SCSU:\r
       CopyMem (&StringCount, BlockHdr + sizeof (EFI_HII_STRING_BLOCK), sizeof (UINT16));\r
-      StringTextPtr = BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_BLOCK) - sizeof (UINT8);\r
+      StringTextPtr = (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_BLOCK) - sizeof (UINT8));\r
       BlockSize += StringTextPtr - BlockHdr;\r
 \r
       for (Index = 0; Index < StringCount; Index++) {\r
@@ -355,10 +355,10 @@ FindStringBlock (
     case EFI_HII_SIBT_STRINGS_SCSU_FONT:\r
       CopyMem (\r
         &StringCount,\r
-        BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),\r
+        (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8)),\r
         sizeof (UINT16)\r
         );\r
-      StringTextPtr = BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK) - sizeof (UINT8);\r
+      StringTextPtr = (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK) - sizeof (UINT8));\r
       BlockSize += StringTextPtr - BlockHdr;\r
 \r
       for (Index = 0; Index < StringCount; Index++) {\r
@@ -425,7 +425,7 @@ FindStringBlock (
       BlockSize += Offset;\r
       CopyMem (\r
         &StringCount,\r
-        BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),\r
+        (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8)),\r
         sizeof (UINT16)\r
         );\r
       for (Index = 0; Index < StringCount; Index++) {\r
@@ -465,7 +465,7 @@ FindStringBlock (
       break;\r
 \r
     case EFI_HII_SIBT_SKIP1:\r
-      SkipCount = (UINT16) (*(BlockHdr + sizeof (EFI_HII_STRING_BLOCK)));\r
+      SkipCount = (UINT16) (*(UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK)));\r
       CurrentStringId = (UINT16) (CurrentStringId + SkipCount);\r
       BlockSize       +=  sizeof (EFI_HII_SIBT_SKIP1_BLOCK);\r
       break;\r
@@ -479,7 +479,7 @@ FindStringBlock (
     case EFI_HII_SIBT_EXT1:\r
       CopyMem (\r
         &Length8,\r
-        BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),\r
+        (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8)),\r
         sizeof (UINT8)\r
         );\r
       BlockSize += Length8;\r
@@ -494,7 +494,7 @@ FindStringBlock (
         //\r
         BlockHdr += sizeof (EFI_HII_SIBT_EXT2_BLOCK);\r
         CopyMem (&FontId, BlockHdr, sizeof (UINT8));\r
-        BlockHdr += sizeof (UINT8);\r
+        BlockHdr ++;\r
         CopyMem (&FontSize, BlockHdr, sizeof (UINT16));\r
         BlockHdr += sizeof (UINT16);\r
         CopyMem (&FontStyle, BlockHdr, sizeof (EFI_HII_FONT_STYLE));\r
@@ -535,7 +535,7 @@ FindStringBlock (
     case EFI_HII_SIBT_EXT4:\r
       CopyMem (\r
         &Length32,\r
-        BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),\r
+        (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8)),\r
         sizeof (UINT32)\r
         );\r
 \r
@@ -1080,7 +1080,7 @@ SetStringWorker (
   BlockPtr += sizeof (EFI_HII_SIBT_EXT2_BLOCK);\r
 \r
   *BlockPtr = LocalFont->FontId;\r
-  BlockPtr += sizeof (UINT8);\r
+  BlockPtr ++;\r
   CopyMem (BlockPtr, &GlobalFont->FontInfo->FontSize, sizeof (UINT16));\r
   BlockPtr += sizeof (UINT16);\r
   CopyMem (BlockPtr, &GlobalFont->FontInfo->FontStyle, sizeof (UINT32));\r
@@ -1442,7 +1442,7 @@ HiiNewString (
       *BlockPtr = EFI_HII_SIBT_STRING_UCS2_FONT;\r
       BlockPtr  += sizeof (EFI_HII_STRING_BLOCK);\r
       *BlockPtr = LocalFont->FontId;\r
-      BlockPtr  += sizeof (UINT8);\r
+      BlockPtr ++;\r
       CopyMem (BlockPtr, (EFI_STRING) String, StrSize ((EFI_STRING) String));\r
       BlockPtr += StrSize ((EFI_STRING) String);\r
 \r
@@ -1486,7 +1486,7 @@ HiiNewString (
       BlockPtr += sizeof (EFI_HII_SIBT_EXT2_BLOCK);\r
 \r
       *BlockPtr = LocalFont->FontId;\r
-      BlockPtr += sizeof (UINT8);\r
+      BlockPtr ++;\r
       CopyMem (BlockPtr, &((EFI_FONT_INFO *) StringFontInfo)->FontSize, sizeof (UINT16));\r
       BlockPtr += sizeof (UINT16);\r
       CopyMem (BlockPtr, &((EFI_FONT_INFO *) StringFontInfo)->FontStyle, sizeof (EFI_HII_FONT_STYLE));\r
@@ -1503,7 +1503,7 @@ HiiNewString (
       *BlockPtr = EFI_HII_SIBT_STRING_UCS2_FONT;\r
       BlockPtr  += sizeof (EFI_HII_STRING_BLOCK);\r
       *BlockPtr = LocalFont->FontId;\r
-      BlockPtr  += sizeof (UINT8);\r
+      BlockPtr  ++;\r
       CopyMem (BlockPtr, (EFI_STRING) String, StrSize ((EFI_STRING) String));\r
       BlockPtr += StrSize ((EFI_STRING) String);\r
 \r
index ae31e3ac5925e1672e552b3a4e75d2a24938fd73..e0768404f9fc61c3fdd02b3a0a38a38102f6be38 100644 (file)
@@ -3,7 +3,7 @@
   Emulation Variable services operate on the runtime volatile memory.\r
   The nonvolatile variable space doesn't exist.\r
 \r
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -320,9 +320,9 @@ UpdateVariableInfo (
       ASSERT (gVariableInfo != NULL);\r
 \r
       CopyGuid (&gVariableInfo->VendorGuid, VendorGuid);\r
-      gVariableInfo->Name = AllocatePool (StrSize (VariableName));\r
+      gVariableInfo->Name = AllocateZeroPool (StrSize (VariableName));\r
       ASSERT (gVariableInfo->Name != NULL);\r
-      StrCpy (gVariableInfo->Name, VariableName);\r
+      StrnCpy (gVariableInfo->Name, VariableName, StrLen (VariableName));\r
       gVariableInfo->Volatile = Volatile;\r
 \r
       gBS->InstallConfigurationTable (&gEfiVariableGuid, gVariableInfo);\r
@@ -358,9 +358,9 @@ UpdateVariableInfo (
         ASSERT (Entry->Next != NULL);\r
 \r
         CopyGuid (&Entry->Next->VendorGuid, VendorGuid);\r
-        Entry->Next->Name = AllocatePool (StrSize (VariableName));\r
+        Entry->Next->Name = AllocateZeroPool (StrSize (VariableName));\r
         ASSERT (Entry->Next->Name != NULL);\r
-        StrCpy (Entry->Next->Name, VariableName);\r
+        StrnCpy (Entry->Next->Name, VariableName, StrLen (VariableName));\r
         Entry->Next->Volatile = Volatile;\r
       }\r
 \r
index 9101da37a666ad3e717a8b771a652f8f97434cb4..fc7fbab5d6d024c50264795364f4dc35411c1f24 100644 (file)
@@ -139,9 +139,9 @@ UpdateVariableInfo (
       ASSERT (gVariableInfo != NULL);\r
 \r
       CopyGuid (&gVariableInfo->VendorGuid, VendorGuid);\r
-      gVariableInfo->Name = AllocatePool (StrSize (VariableName));\r
+      gVariableInfo->Name = AllocateZeroPool (StrSize (VariableName));\r
       ASSERT (gVariableInfo->Name != NULL);\r
-      StrCpy (gVariableInfo->Name, VariableName);\r
+      StrnCpy (gVariableInfo->Name, VariableName, StrLen (VariableName));\r
       gVariableInfo->Volatile = Volatile;\r
     }\r
 \r
@@ -175,9 +175,9 @@ UpdateVariableInfo (
         ASSERT (Entry->Next != NULL);\r
 \r
         CopyGuid (&Entry->Next->VendorGuid, VendorGuid);\r
-        Entry->Next->Name = AllocatePool (StrSize (VariableName));\r
+        Entry->Next->Name = AllocateZeroPool (StrSize (VariableName));\r
         ASSERT (Entry->Next->Name != NULL);\r
-        StrCpy (Entry->Next->Name, VariableName);\r
+        StrnCpy (Entry->Next->Name, VariableName, StrLen (VariableName));\r
         Entry->Next->Volatile = Volatile;\r
       }\r
 \r
@@ -2251,7 +2251,7 @@ VariableLockRequestToLock (
     return EFI_ACCESS_DENIED;\r
   }\r
 \r
-  Entry = AllocateRuntimePool (sizeof (*Entry) + StrSize (VariableName));\r
+  Entry = AllocateRuntimeZeroPool (sizeof (*Entry) + StrSize (VariableName));\r
   if (Entry == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -2261,7 +2261,7 @@ VariableLockRequestToLock (
   AcquireLockOnlyAtBootTime(&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);\r
 \r
   Entry->Name = (CHAR16 *) (Entry + 1);\r
-  StrCpy   (Entry->Name, VariableName);\r
+  StrnCpy   (Entry->Name, VariableName, StrLen (VariableName));\r
   CopyGuid (&Entry->Guid, VendorGuid);\r
   InsertTailList (&mLockedVariableList, &Entry->Link);\r
 \r