Clarify return value for NULL pointer in LocateProtocol() API When input parameter Protocol is NULL, EFI_INVALID_PARAMETER should be returned.
Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Jin <[email protected]> Cc: Supreeth Venkatesh <[email protected]> Cc: Jiaxin Wu <[email protected]> --- .../ProtocolHandlerServices/BlackBoxTest/Guid.c | 8 +++---- .../ProtocolHandlerServices/BlackBoxTest/Guid.h | 12 ++++------ .../ProtocolHandlerBBTestConformance.c | 27 +++++++++++++++++++++- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/Guid.c index 4069d2f..40927f7 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/Guid.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/Guid.c @@ -1,7 +1,7 @@ /** @file Copyright 2006 - 2016 Unified EFI, Inc.<BR> - Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -44,7 +44,7 @@ EFI_GUID gConsistencyTestAssertionGuid007 = EFI_TEST_CONSISTENCYTEST_ASSERTION_0 EFI_GUID gConsistencyTestAssertionGuid008 = EFI_TEST_CONSISTENCYTEST_ASSERTION_008_GUID; -//EFI_GUID gConsistencyTestAssertionGuid009 = EFI_TEST_CONSISTENCYTEST_ASSERTION_009_GUID; +EFI_GUID gConsistencyTestAssertionGuid009 = EFI_TEST_CONSISTENCYTEST_ASSERTION_009_GUID; EFI_GUID gConsistencyTestAssertionGuid010 = EFI_TEST_CONSISTENCYTEST_ASSERTION_010_GUID; @@ -70,7 +70,7 @@ EFI_GUID gConsistencyTestAssertionGuid020 = EFI_TEST_CONSISTENCYTEST_ASSERTION_0 EFI_GUID gConsistencyTestAssertionGuid021 = EFI_TEST_CONSISTENCYTEST_ASSERTION_021_GUID; -EFI_GUID gConsistencyTestAssertionGuid022 = EFI_TEST_CONSISTENCYTEST_ASSERTION_022_GUID; +//EFI_GUID gConsistencyTestAssertionGuid022 = EFI_TEST_CONSISTENCYTEST_ASSERTION_022_GUID; EFI_GUID gConsistencyTestAssertionGuid023 = EFI_TEST_CONSISTENCYTEST_ASSERTION_023_GUID; @@ -140,7 +140,7 @@ EFI_GUID gConsistencyTestAssertionGuid055 = EFI_TEST_CONSISTENCYTEST_ASSERTION_0 EFI_GUID gConsistencyTestAssertionGuid056 = EFI_TEST_CONSISTENCYTEST_ASSERTION_056_GUID; -EFI_GUID gConsistencyTestAssertionGuid057 = EFI_TEST_CONSISTENCYTEST_ASSERTION_057_GUID; +//EFI_GUID gConsistencyTestAssertionGuid057 = EFI_TEST_CONSISTENCYTEST_ASSERTION_057_GUID; EFI_GUID gConsistencyTestAssertionGuid058 = EFI_TEST_CONSISTENCYTEST_ASSERTION_058_GUID; diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/Guid.h index 06fbc80..d42d968 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/Guid.h +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/Guid.h @@ -1,7 +1,7 @@ /** @file Copyright 2006 - 2016 Unified EFI, Inc.<BR> - Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -65,12 +65,10 @@ extern EFI_GUID gConsistencyTestAssertionGuid007; extern EFI_GUID gConsistencyTestAssertionGuid008; -/* #define EFI_TEST_CONSISTENCYTEST_ASSERTION_009_GUID \ { 0xe9712c64, 0x302e, 0x4984, {0x9e, 0xc2, 0xb9, 0x91, 0xd3, 0x5e, 0x2e, 0x11 }} extern EFI_GUID gConsistencyTestAssertionGuid009; -*/ #define EFI_TEST_CONSISTENCYTEST_ASSERTION_010_GUID \ { 0xf7c8a812, 0x97c8, 0x4283, {0xa7, 0x79, 0x9c, 0x3a, 0x0d, 0xf9, 0x9b, 0x44 }} @@ -131,12 +129,12 @@ extern EFI_GUID gConsistencyTestAssertionGuid020; { 0x0df6b782, 0xbb9c, 0x40e1, {0x99, 0x31, 0xfa, 0x07, 0xce, 0x4e, 0xf3, 0x2d }} extern EFI_GUID gConsistencyTestAssertionGuid021; - +/* #define EFI_TEST_CONSISTENCYTEST_ASSERTION_022_GUID \ { 0x8508de3d, 0x795d, 0x4833, {0x8c, 0xe2, 0x3c, 0xf9, 0x60, 0x05, 0x50, 0x5b }} extern EFI_GUID gConsistencyTestAssertionGuid022; - +*/ #define EFI_TEST_CONSISTENCYTEST_ASSERTION_023_GUID \ { 0x6cad11b3, 0x9ea5, 0x4d60, {0xb0, 0x6c, 0xaf, 0xf3, 0xfd, 0xef, 0x90, 0x8d }} @@ -306,12 +304,12 @@ extern EFI_GUID gConsistencyTestAssertionGuid055; { 0x357d40b9, 0xa9b0, 0x4462, {0xa4, 0xc7, 0x40, 0xca, 0x18, 0xcb, 0x17, 0x34 }} extern EFI_GUID gConsistencyTestAssertionGuid056; - +/* #define EFI_TEST_CONSISTENCYTEST_ASSERTION_057_GUID \ { 0xf4f96d88, 0x1924, 0x4d35, {0x94, 0xc9, 0x7f, 0x7b, 0x6e, 0x42, 0xc2, 0xd4 }} extern EFI_GUID gConsistencyTestAssertionGuid057; - +*/ #define EFI_TEST_CONSISTENCYTEST_ASSERTION_058_GUID \ { 0x4f733e46, 0xdacb, 0x4f6f, {0x80, 0x2b, 0x05, 0x45, 0x00, 0x3a, 0x6a, 0x64 }} diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/ProtocolHandlerBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/ProtocolHandlerBBTestConformance.c index 98ce893..ec3637d 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/ProtocolHandlerBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/ProtocolHandlerBBTestConformance.c @@ -1,7 +1,7 @@ /** @file Copyright 2006 - 2016 Unified EFI, Inc.<BR> - Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -2487,6 +2487,31 @@ BBTestLocateProtocolConsistencyTest ( ); // + // Add a checkpoint from the 1559 + // If Protocol is NULL, then EFI_INVALID_PARAMETER is returned + // + Status = gtBS->LocateProtocol ( + NULL, + NULL, + (VOID **) &TestProtocol2 + ); + if (Status == EFI_INVALID_PARAMETER) { + AssertionType = EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gConsistencyTestAssertionGuid009, + L"BS.LocateProtocol - ConsistencyTestCheckpoint4", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // // Checkpoint 2: // 3.10.2.2 LocateProtocol should not succeed // with a protocol GUID that was never installed -- 2.9.0.windows.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

