diff --git a/MdeModulePkg/Include/Library/NetLib.h b/MdeModulePkg/Include/Library/NetLib.h index ba352dea60..c9715012a7 100644 --- a/MdeModulePkg/Include/Library/NetLib.h +++ b/MdeModulePkg/Include/Library/NetLib.h @@ -215,7 +215,7 @@ Ip4IsUnicast ( IN IP4_ADDR NetMask ); -extern IP4_ADDR mIp4AllMasks [IP4_MASK_NUM]; +extern IP4_ADDR gIp4AllMasks [IP4_MASK_NUM]; extern EFI_IPv4_ADDRESS mZeroIp4Addr; diff --git a/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c b/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c index 99f7285108..7271108c40 100644 --- a/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c +++ b/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c @@ -22,6 +22,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include +#define EFI_SECITON_SIZE_MASK 0x00ffffff + typedef struct { EFI_GUID_DEFINED_SECTION GuidedSectionHeader; UINT32 CRC32Checksum; @@ -64,7 +66,7 @@ Crc32GuidedSectionGetInfo ( // *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes; *ScratchBufferSize = 0; - *OutputBufferSize = *(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size) & 0x00ffffff; + *OutputBufferSize = *(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size) & EFI_SECITON_SIZE_MASK; *OutputBufferSize -= ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset; return EFI_SUCCESS; @@ -117,7 +119,7 @@ Crc32GuidedSectionHandler ( // Crc32SectionHeader = (CRC32_SECTION_HEADER *) InputSection; *OutputBuffer = (UINT8 *) InputSection + Crc32SectionHeader->GuidedSectionHeader.DataOffset; - OutputBufferSize = *(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size) & 0x00ffffff; + OutputBufferSize = *(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size) & EFI_SECITON_SIZE_MASK; OutputBufferSize -= Crc32SectionHeader->GuidedSectionHeader.DataOffset; // diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c index bf1a969821..a3ea083b51 100644 --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c @@ -43,7 +43,7 @@ EFI_DPC_PROTOCOL *mDpc = NULL; // // All the supported IP4 maskes in host byte order. // -IP4_ADDR mIp4AllMasks[IP4_MASK_NUM] = { +IP4_ADDR gIp4AllMasks[IP4_MASK_NUM] = { 0x00000000, 0x80000000, 0xC0000000, @@ -104,7 +104,7 @@ NetGetMaskLength ( INTN Index; for (Index = 0; Index < IP4_MASK_NUM; Index++) { - if (NetMask == mIp4AllMasks[Index]) { + if (NetMask == gIp4AllMasks[Index]) { break; } } @@ -179,7 +179,7 @@ Ip4IsUnicast ( } if (NetMask == 0) { - NetMask = mIp4AllMasks[Class << 3]; + NetMask = gIp4AllMasks[Class << 3]; } if (((Ip &~NetMask) == ~NetMask) || ((Ip &~NetMask) == 0)) { diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c index 1f168c6dff..b09eb4f5f3 100644 --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c @@ -409,7 +409,7 @@ DhcpLeaseAcquired ( if (DhcpSb->Netmask == 0) { Class = NetGetIpClass (DhcpSb->ClientAddr); - DhcpSb->Netmask = mIp4AllMasks[Class << 3]; + DhcpSb->Netmask = gIp4AllMasks[Class << 3]; } if (DhcpSb->LeaseIoPort != NULL) { diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c index d8f88e14b1..5e121a5dcf 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c @@ -554,7 +554,7 @@ Ip4SetAddress ( Type = NetGetIpClass (IpAddr); Len = NetGetMaskLength (SubnetMask); - Netmask = mIp4AllMasks[MIN (Len, Type << 3)]; + Netmask = gIp4AllMasks[MIN (Len, Type << 3)]; Interface->NetBrdcast = (IpAddr | ~Netmask); // diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c index d1302acaa3..ce546c235d 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c @@ -796,7 +796,7 @@ Ip4StationAddressValid ( return FALSE; } - NetBrdcastMask = mIp4AllMasks[MIN (Len, Type << 3)]; + NetBrdcastMask = gIp4AllMasks[MIN (Len, Type << 3)]; if (Ip == (Ip | ~NetBrdcastMask)) { return FALSE;