Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP<BR>\r
Copyright (c) Microsoft Corporation.<BR>\r
+Copyright (c) 2022, ARM Limited. All rights reserved.<BR>\r
\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
}\r
\r
//\r
- // Make sure if runtime bit is set, boot service bit is set also.\r
+ // Check if the combination of attribute bits is valid.\r
//\r
if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS) {\r
+ //\r
+ // Make sure if runtime bit is set, boot service bit is set also.\r
+ //\r
if ((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) {\r
return EFI_UNSUPPORTED;\r
} else {\r
return EFI_INVALID_PARAMETER;\r
}\r
+ } else if ((Attributes & EFI_VARIABLE_ATTRIBUTES_MASK) == EFI_VARIABLE_NON_VOLATILE) {\r
+ //\r
+ // Only EFI_VARIABLE_NON_VOLATILE attribute is invalid\r
+ //\r
+ return EFI_INVALID_PARAMETER;\r
} else if ((Attributes & VARIABLE_ATTRIBUTE_AT_AW) != 0) {\r
if (!mVariableModuleGlobal->VariableGlobal.AuthSupport) {\r
//\r
// Make sure the Attributes combination is supported by the platform.\r
//\r
return EFI_UNSUPPORTED;\r
+ } else if ((Attributes & EFI_VARIABLE_ATTRIBUTES_MASK) == EFI_VARIABLE_NON_VOLATILE) {\r
+ //\r
+ // Only EFI_VARIABLE_NON_VOLATILE attribute is invalid\r
+ //\r
+ return EFI_INVALID_PARAMETER;\r
} else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS) {\r
//\r
// Make sure if runtime bit is set, boot service bit is set also.\r