/** @file\r
PCI Rom supporting funtions implementation for PCI Bus module.\r
\r
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, 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
NextImage:\r
RomBarOffset += ImageSize;\r
\r
- } while (((Indicator & 0x80) == 0x00) && ((UINTN) (RomBarOffset - (UINT8 *) RomBar) < PciDevice->RomSize));\r
+ } while (((Indicator & 0x80) == 0x00) && (((UINTN) RomBarOffset - (UINTN) RomBar) < PciDevice->RomSize));\r
\r
return RetStatus;\r
}\r
(sizeof (NET_BUF) + ((BlockOpNum) - 1) * sizeof (NET_BLOCK_OP))\r
\r
#define NET_HEADSPACE(BlockOp) \\r
- (UINTN)((BlockOp)->Head - (BlockOp)->BlockHead)\r
+ ((UINTN)((BlockOp)->Head) - (UINTN)((BlockOp)->BlockHead))\r
\r
#define NET_TAILSPACE(BlockOp) \\r
- (UINTN)((BlockOp)->BlockTail - (BlockOp)->Tail)\r
+ ((UINTN)((BlockOp)->BlockTail) - (UINTN)((BlockOp)->Tail))\r
\r
/**\r
Allocate a single block NET_BUF. Upon allocation, all the\r
ValidateFmpCapsule(), DisplayCapsuleImage(), ConvertBmpToGopBlt() will\r
receive untrusted input and do basic validation.\r
\r
- Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2016 - 2017, 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
\r
}\r
\r
- ImageIndex = (UINTN) (Image - ImageHeader);\r
+ ImageIndex = (UINTN) Image - (UINTN) ImageHeader;\r
if ((ImageIndex % 4) != 0) {\r
//\r
// Bmp Image starts each row on a 32-bit boundary!\r
//\r
// If BASE_LIST is larger than Size, then return FALSE\r
//\r
- if ((UINTN)((UINT8 *)BaseListMarker - (UINT8 *)BaseListStart) > Size) {\r
+ if (((UINTN)BaseListMarker - (UINTN)BaseListStart) > Size) {\r
DEBUG ((DEBUG_ERROR, "The input variable argument list is too long. Please consider breaking into multiple print calls.\n"));\r
return FALSE;\r
}\r
// that overlap.\r
//\r
StrCpyS (TmpStr, MaxLen, Ptr + 3);\r
- StrCpyS (LastSlash, MaxLen - (UINTN) (LastSlash - Str), TmpStr);\r
+ StrCpyS (LastSlash, MaxLen - ((UINTN) LastSlash - (UINTN) Str) / sizeof (CHAR16), TmpStr);\r
Ptr = LastSlash;\r
} else if (*Ptr == '\\' && *(Ptr + 1) == '.' && *(Ptr + 2) == '\\') {\r
//\r
// that overlap.\r
//\r
StrCpyS (TmpStr, MaxLen, Ptr + 2);\r
- StrCpyS (Ptr, MaxLen - (UINTN) (Ptr - Str), TmpStr);\r
+ StrCpyS (Ptr, MaxLen - ((UINTN) Ptr - (UINTN) Str) / sizeof (CHAR16), TmpStr);\r
Ptr = LastSlash;\r
} else if (*Ptr == '\\') {\r
LastSlash = Ptr;\r
/** @file\r
Save the S3 data to S3 boot script.\r
\r
- Copyright (c) 2006 - 2016, 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
// calculate the Position offset\r
//\r
if (Position != NULL) {\r
- PositionOffset = (UINTN) ((UINT8 *)Position - S3TableBase);\r
+ PositionOffset = (UINTN)Position - (UINTN)S3TableBase;\r
\r
//\r
// If the BeforeOrAfter is FALSE, that means to insert the node right after the node.\r
/** @file\r
Load option library functions which relate with creating and processing load options.\r
\r
-Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
FilePath = (EFI_DEVICE_PATH_PROTOCOL *) VariablePtr;\r
VariablePtr += FilePathSize;\r
\r
- OptionalDataSize = (UINT32) (VariableSize - (UINTN) (VariablePtr - Variable));\r
+ OptionalDataSize = (UINT32) (VariableSize - ((UINTN) VariablePtr - (UINTN) Variable));\r
if (OptionalDataSize == 0) {\r
OptionalData = NULL;\r
} else {\r
ALL CODE IN THE SERIALIO STACK MUST BE RE-ENTRANT AND CALLABLE FROM\r
INTERRUPT CONTEXT\r
\r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, 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
LocalBufferSize = *BufferSize - (BufferPtr - (UINT8 *) Buffer);\r
} while (LocalBufferSize != 0 && Timeout > 0);\r
\r
- *BufferSize = (UINTN) (BufferPtr - (UINT8 *) Buffer);\r
+ *BufferSize = (UINTN) BufferPtr - (UINTN) Buffer;\r
\r
return Status;\r
}\r
These are the common Fault Tolerant Write (FTW) functions that are shared \r
by DXE FTW driver and SMM FTW driver.\r
\r
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, 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
//\r
// If Record is out of the range of Header, return access denied.\r
//\r
- if (((UINTN)((UINT8 *) Record - (UINT8 *) Header)) > FTW_WRITE_TOTAL_SIZE (Header->NumberOfWrites - 1, Header->PrivateDataSize)) {\r
+ if (((UINTN) Record - (UINTN) Header) > FTW_WRITE_TOTAL_SIZE (Header->NumberOfWrites - 1, Header->PrivateDataSize)) {\r
return EFI_ACCESS_DENIED;\r
}\r
\r
Implementation for EFI_HII_IMAGE_PROTOCOL.\r
\r
\r
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2017, 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
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- Part1Size = (UINT32) (UINTN) ((UINT8 *) CurrentImageBlock - (UINT8 *) ImagePackage->ImageBlock);\r
+ Part1Size = (UINT32) ((UINTN) CurrentImageBlock - (UINTN) ImagePackage->ImageBlock);\r
Part2Size = ImagePackage->ImageBlockSize - Part1Size - OldBlockSize;\r
CopyMem (ImageBlocks, ImagePackage->ImageBlock, Part1Size);\r
\r
VariableServiceSetVariable() should also check authenticate data to avoid buffer overflow,\r
integer overflow. It should also check attribute to avoid authentication bypass.\r
\r
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
// Install the new variable if it is not NULL.\r
//\r
if (NewVariable != NULL) {\r
- if ((UINTN) (CurrPtr - ValidBuffer) + NewVariableSize > VariableStoreHeader->Size) {\r
+ if (((UINTN) CurrPtr - (UINTN) ValidBuffer) + NewVariableSize > VariableStoreHeader->Size) {\r
//\r
// No enough space to store the new variable.\r
//\r
// If volatile variable store, just copy valid buffer.\r
//\r
SetMem ((UINT8 *) (UINTN) VariableBase, VariableStoreHeader->Size, 0xff);\r
- CopyMem ((UINT8 *) (UINTN) VariableBase, ValidBuffer, (UINTN) (CurrPtr - ValidBuffer));\r
- *LastVariableOffset = (UINTN) (CurrPtr - ValidBuffer);\r
+ CopyMem ((UINT8 *) (UINTN) VariableBase, ValidBuffer, (UINTN) CurrPtr - (UINTN) ValidBuffer);\r
+ *LastVariableOffset = (UINTN) CurrPtr - (UINTN) ValidBuffer;\r
Status = EFI_SUCCESS;\r
} else {\r
//\r
(VARIABLE_STORE_HEADER *) ValidBuffer\r
);\r
if (!EFI_ERROR (Status)) {\r
- *LastVariableOffset = (UINTN) (CurrPtr - ValidBuffer);\r
+ *LastVariableOffset = (UINTN) CurrPtr - (UINTN) ValidBuffer;\r
mVariableModuleGlobal->HwErrVariableTotalSize = HwErrVariableTotalSize;\r
mVariableModuleGlobal->CommonVariableTotalSize = CommonVariableTotalSize;\r
mVariableModuleGlobal->CommonUserVariableTotalSize = CommonUserVariableTotalSize;\r