From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.2465.1628213608185789789 for ; Thu, 05 Aug 2021 18:33:28 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=DNniH4dY; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from localhost.localdomain (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id DB66520B36EA; Thu, 5 Aug 2021 18:33:27 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DB66520B36EA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1628213607; bh=8MP5EmYW+6xk1sIRmRcpQlB8bkRB15g/f2dpIVpEHVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DNniH4dYSxPIFEy95PDwtuTSHnc2Re/lJLTbr4eJpJsX+tqcyInnxFPbhXFik9GjG LghXeCVqD8DE+s+0HzeZbhnMB/LmUFeCT32jTZU5U7llxhjIAh8x1FoAuFL2mEE//U NttVfA89mEeySd5zCyRPVsVuqm7Yb2CBMRp6GqmA= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-platforms][PATCH v2 5/5] MinPlatformPkg/TestPointCheckLib: Make OutTable parameter optional Date: Thu, 5 Aug 2021 21:32:50 -0400 Message-Id: <20210806013250.2928-6-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20210806013250.2928-1-mikuback@linux.microsoft.com> References: <20210806013250.2928-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Kubacki Makes the OutTable parameter in DumpAcpiRsdt() and DumpAcpiXsdt() optional since the pointer passed can be NULL if the Signature pointer is also NULL. Can fix a potential failure in TestPointCheckAcpi(). Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: Michael Kubacki Reviewed-by: Nate DeSimone --- Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckAcp= i.c | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib= /DxeCheckAcpi.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointChe= ckLib/DxeCheckAcpi.c index cd8f538f7f3f..3d75e5012a4c 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChe= ckAcpi.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChe= ckAcpi.c @@ -477,7 +477,7 @@ DumpAcpiTable ( ) { EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt; - =20 + if (Table =3D=3D NULL) { return ; } @@ -535,7 +535,7 @@ CheckAcpiTableResource ( ) { EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt; - =20 + if (Table =3D=3D NULL) { return EFI_INVALID_PARAMETER; } @@ -592,7 +592,7 @@ EFI_STATUS DumpAcpiRsdt ( IN EFI_ACPI_DESCRIPTION_HEADER *Rsdt, IN UINT32 *Signature, OPTIONAL - OUT VOID **OutTable, + OUT VOID **OutTable, OPTIONAL IN BOOLEAN DumpPrint, IN BOOLEAN CheckResource ) @@ -610,7 +610,7 @@ DumpAcpiRsdt ( =20 if (OutTable !=3D NULL) { *OutTable =3D NULL; - } else { + } else if ((OutTable =3D=3D NULL) && (Signature !=3D NULL)) { return EFI_INVALID_PARAMETER; } =20 @@ -632,7 +632,7 @@ DumpAcpiRsdt ( *OutTable =3D Table; } } - =20 + if (OutTable !=3D NULL) { if (*OutTable =3D=3D NULL) { return EFI_NOT_FOUND; @@ -646,7 +646,7 @@ EFI_STATUS DumpAcpiXsdt ( IN EFI_ACPI_DESCRIPTION_HEADER *Xsdt, IN UINT32 *Signature, OPTIONAL - OUT VOID **OutTable, + OUT VOID **OutTable, OPTIONAL IN BOOLEAN DumpPrint, IN BOOLEAN CheckResource ) @@ -662,16 +662,16 @@ DumpAcpiXsdt ( if (Xsdt =3D=3D NULL) { return EFI_INVALID_PARAMETER; } - =20 + if (OutTable !=3D NULL) { *OutTable =3D NULL; - } else { + } else if ((OutTable =3D=3D NULL) && (Signature !=3D NULL)) { return EFI_INVALID_PARAMETER; } =20 ReturnStatus =3D EFI_SUCCESS; EntryCount =3D (Xsdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) /= sizeof(UINT64); - =20 + BasePtr =3D (UINTN)(Xsdt + 1); for (Index =3D 0; Index < EntryCount; Index ++) { CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * sizeof(UINT64)), size= of(UINT64)); @@ -783,7 +783,7 @@ TestPointCheckAcpi ( if (Status =3D=3D EFI_NOT_FOUND) { Status =3D DumpAcpiWithGuid (&gEfiAcpi10TableGuid, NULL, NULL, TRUE,= FALSE); } - =20 + if (EFI_ERROR(Status)) { DEBUG ((DEBUG_ERROR, "No ACPI table\n")); TestPointLibAppendErrorString ( @@ -796,7 +796,7 @@ TestPointCheckAcpi ( } =20 DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointCheckAcpi - Exit\n")); - =20 + return Status; } =20 @@ -806,9 +806,9 @@ TestPointCheckAcpiGcdResource ( ) { EFI_STATUS Status; - =20 + DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointCheckAcpiGcdResource - Ente= r\n")); - =20 + // // Check the ACPI existence // @@ -816,7 +816,7 @@ TestPointCheckAcpiGcdResource ( if (Status =3D=3D EFI_NOT_FOUND) { Status =3D DumpAcpiWithGuid (&gEfiAcpi10TableGuid, NULL, NULL, FALSE= , FALSE); } - =20 + if (!EFI_ERROR(Status)) { // // Then check resource in ACPI and GCD @@ -828,7 +828,7 @@ TestPointCheckAcpiGcdResource ( Status =3D DumpAcpiWithGuid (&gEfiAcpi10TableGuid, NULL, NULL, FAL= SE, TRUE); } } - =20 + if (EFI_ERROR(Status)) { DEBUG ((DEBUG_ERROR, "ACPI table resource not in GCD\n")); TestPointLibAppendErrorString ( @@ -840,7 +840,7 @@ TestPointCheckAcpiGcdResource ( ); } DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointCheckAcpiGcdResource - Exit= \n")); - =20 + return Status; } =20 --=20 2.28.0.windows.1