Skip to content

Commit aae044a

Browse files
vineelkoTaylorBeebekenlautnercorthon
authored andcommitted
EmbeddedPkg: CodeQL Fixes.
Makes changes to comply with alerts raised by CodeQL. Most of the issues here fall into the following two categories: 1. Potential use of uninitialized pointer. 2. Inconsistent integer width in comparison. Co-authored-by: Taylor Beebe <taylor.d.beebe@gmail.com> Co-authored-by: Ken Lautner <kenlautner3@gmail.com> Co-authored-by: Bret Barkelew <bret@corthon.com> Signed-off-by: Vineel Kovvuri[MSFT] <vineelko@microsoft.com>
1 parent d6f828b commit aae044a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

EmbeddedPkg/Library/PrePiHobLib/Hob.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,9 @@ BuildGuidDataHob (
498498
ASSERT (Data != NULL || DataLength == 0);
499499

500500
HobData = BuildGuidHob (Guid, DataLength);
501+
if (HobData == NULL) {
502+
return NULL;
503+
}
501504

502505
return CopyMem (HobData, Data, DataLength);
503506
}

EmbeddedPkg/Library/PrePiLib/FwVol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ FfsProcessSection (
283283
{
284284
EFI_STATUS Status;
285285
UINT32 SectionLength;
286-
UINT32 ParsedLength;
286+
UINTN ParsedLength;
287287
EFI_COMPRESSION_SECTION *CompressionSection;
288288
EFI_COMPRESSION_SECTION2 *CompressionSection2;
289289
UINT32 DstBufferSize;

EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOut.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,9 @@ OutputString (
504504

505505
Size = StrLen (String) + 1;
506506
OutputString = AllocatePool (Size);
507+
if (OutputString == NULL) {
508+
return EFI_OUT_OF_RESOURCES;
509+
}
507510

508511
// If there is any non-ascii characters in String buffer then replace it with '?'
509512
// Eventually, UnicodeStrToAsciiStr API should be fixed.

0 commit comments

Comments
 (0)