From 224b1cc286122b8aca5002fec31ed0390b299403 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 26 Sep 2016 07:42:24 +0200 Subject: Fix various issues reported by Coverity --- Library/DcsCfgLib/GptEdit.c | 8 ++++++-- Library/PasswordLib/PlatformID.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'Library') diff --git a/Library/DcsCfgLib/GptEdit.c b/Library/DcsCfgLib/GptEdit.c index 702ce5d..f814975 100644 --- a/Library/DcsCfgLib/GptEdit.c +++ b/Library/DcsCfgLib/GptEdit.c @@ -143,7 +143,7 @@ GptCheckEntryArray( UINT32 Crc; UINTN Size; - Size = PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry; + Size = (UINTN) PartHeader->NumberOfPartitionEntries * (UINTN) PartHeader->SizeOfPartitionEntry; Status = gBS->CalculateCrc32(Entrys, Size, &Crc); if (EFI_ERROR(Status)) { return EFI_CRC_ERROR; @@ -162,7 +162,7 @@ GptUpdateCRC( UINT32 Crc; UINTN Size; - Size = PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry; + Size = (UINTN) PartHeader->NumberOfPartitionEntries * (UINTN) PartHeader->SizeOfPartitionEntry; Status = gBS->CalculateCrc32(Entrys, Size, &Crc); if (EFI_ERROR(Status)) { return Status; @@ -489,6 +489,10 @@ DeListSaveToFile() { } if (pad > 0) { res = FileWrite(file, pad512buf, &pad, NULL); + if (EFI_ERROR(res)) { + ERR_PRINT(L"Write: %r\n", res); + goto error; + } } } } diff --git a/Library/PasswordLib/PlatformID.c b/Library/PasswordLib/PlatformID.c index 351503e..63b2e7d 100644 --- a/Library/PasswordLib/PlatformID.c +++ b/Library/PasswordLib/PlatformID.c @@ -236,7 +236,7 @@ PlatformGetAuthDataByType( continue; } *data = buf; - *len = mark->AuthDataSize * 1024 * 128; + *len = ((UINTN) mark->AuthDataSize) * 1024 * 128; *secRegionHandle = gBIOHandles[gBioIndexAuth]; return EFI_SUCCESS; } -- cgit v1.2.3