From 1a45b15eae48d9bf498daf5b0c0771659d75faa2 Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Fri, 8 Aug 2014 05:52:01 +0000 Subject: Add type cast on variable before operation. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Eric Dong git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15778 6f19259b-4bc3-4df7-8a09-765794883524 --- IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c | 4 ++-- IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c | 4 ++-- IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'IntelFrameworkModulePkg/Universal') diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c index 22c2eb3c7e..0d3b489e35 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c @@ -1761,12 +1761,12 @@ GetLegacyDeviceOrder ( break; } - WorkingVarData += sizeof (BBS_TYPE); + WorkingVarData = (UINT8 *)((UINTN)WorkingVarData + sizeof (BBS_TYPE)); WorkingVarData += *(UINT16 *) WorkingVarData; DevOrder = (LEGACY_DEV_ORDER_ENTRY *) WorkingVarData; } for (OptionIndex = 0; OptionIndex < OptionMenu->MenuNumber; OptionIndex++) { - VarDevOrder = *(UINT16 *) ((UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + OptionIndex * sizeof (UINT16)); + VarDevOrder = *(UINT16 *) ((UINTN) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + OptionIndex * sizeof (UINT16)); if (0xFF00 == (VarDevOrder & 0xFF00)) { LegacyOrder[OptionIndex] = 0xFF; Pos = (VarDevOrder & 0xFF) / 8; diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c index a3b9dd8928..20e17dd858 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c @@ -1303,7 +1303,7 @@ UpdateSetLegacyDeviceOrderPage ( break; } - VarData += sizeof (BBS_TYPE); + VarData = (UINT8 *)((UINTN)VarData + sizeof (BBS_TYPE)); VarData += *(UINT16 *) VarData; DevOrder = (LEGACY_DEV_ORDER_ENTRY *) VarData; } @@ -1333,7 +1333,7 @@ UpdateSetLegacyDeviceOrderPage ( NULL ); - VarDevOrder = *(UINT16 *) ((UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + Index * sizeof (UINT16)); + VarDevOrder = *(UINT16 *) ((UINTN) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + Index * sizeof (UINT16)); if (0xFF00 == (VarDevOrder & 0xFF00)) { LegacyOrder[Index] = 0xFF; diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c index aaada9738f..1a864bc779 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c @@ -1085,7 +1085,7 @@ PlatformBdsEnterFrontPage ( // // Clear EFI_OS_INDICATIONS_BOOT_TO_FW_UI to acknowledge OS // - OsIndication &= ~EFI_OS_INDICATIONS_BOOT_TO_FW_UI; + OsIndication &= ~((UINT64)EFI_OS_INDICATIONS_BOOT_TO_FW_UI); Status = gRT->SetVariable ( L"OsIndications", &gEfiGlobalVariableGuid, -- cgit v1.2.3