mirror of https://github.com/ncroxon/gnu-efi
Fix VS2019 Code Analysis warnings
When compiling for x64, Visual Studio 2019's Code Analysis produces the following warnings: C:\Projects\gnu-efi\lib\print.c(1380): warning C26451: Arithmetic overflow: Using operator '+' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '+' to avoid overflow (io.2). C:\Projects\gnu-efi\lib\smbios.c(47): warning C26451: Arithmetic overflow: Using operator '+' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '+' to avoid overflow (io.2). C:\Projects\gnu-efi\lib\str.c(289): warning C26451: Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2). Fix these by adding an explicit cast to UINTN.
This commit is contained in:
parent
40160210a7
commit
4ef183353c
|
@ -1377,7 +1377,7 @@ ValueToString (
|
|||
*(p1++) = (CHAR8)r + '0';
|
||||
}
|
||||
|
||||
c = (Comma ? ca[(p1 - str) % 3] : 999) + 1;
|
||||
c = (UINTN) (Comma ? ca[(p1 - str) % 3] : 999) + 1;
|
||||
while (p1 != str) {
|
||||
|
||||
c -= 1;
|
||||
|
|
|
@ -44,7 +44,7 @@ LibGetSmbiosSystemGuidAndSerialNumber (
|
|||
}
|
||||
|
||||
Smbios.Hdr = (SMBIOS_HEADER *)SmbiosTable->TableAddress;
|
||||
SmbiosEnd.Raw = (UINT8 *)(SmbiosTable->TableAddress + SmbiosTable->TableLength);
|
||||
SmbiosEnd.Raw = (UINT8 *)((UINTN)SmbiosTable->TableAddress + SmbiosTable->TableLength);
|
||||
for (Index = 0; Index < SmbiosTable->TableLength ; Index++) {
|
||||
if (Smbios.Hdr->Type == 1) {
|
||||
if (Smbios.Hdr->Length < 0x19) {
|
||||
|
|
Loading…
Reference in New Issue