From 0986082d7ef68fe63d215af925b22394ac93e544 Mon Sep 17 00:00:00 2001 From: Igor Kulchytskyy Date: Mon, 23 Dec 2024 17:13:19 -0500 Subject: [PATCH] Redfish/HiiUtilityLib Fix incorrect type assignment Replaced direct assignment of 'Value = (EFI_HII_VALUE *)&Question->Value' with the correct usage of HiiStatementValueToHiiValue function. This resolves the issue where EFI_HII_VALUE and HII_STATEMENT_VALUE types are incompatible, ensuring proper handling of Question->Value. Signed-off-by: Igor Kulchytskyy --- .../HiiUtilityLib/HiiUtilityInternal.c | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c b/RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c index b61b7f5fcd..825b02d1fb 100644 --- a/RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c +++ b/RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c @@ -4125,7 +4125,12 @@ EvaluateHiiExpression ( goto Done; } - Value = (EFI_HII_VALUE *)&Question->Value; + Status = HiiStatementValueToHiiValue (&Question->Value, Value); + if (EFI_ERROR (Status)) { + ReleaseHiiValue (Value); + Value->Type = EFI_IFR_TYPE_UNDEFINED; + } + break; case EFI_IFR_SECURITY_OP: @@ -4334,7 +4339,11 @@ EvaluateHiiExpression ( // // push the questions' value on to the expression stack // - Value = (EFI_HII_VALUE *)&Question->Value; + Status = HiiStatementValueToHiiValue (&Question->Value, Value); + if (EFI_ERROR (Status)) { + ReleaseHiiValue (Value); + Value->Type = EFI_IFR_TYPE_UNDEFINED; + } } break; @@ -4461,7 +4470,12 @@ EvaluateHiiExpression ( break; } - Value = (EFI_HII_VALUE *)&Question->Value; + Status = HiiStatementValueToHiiValue (&Question->Value, Value); + if (EFI_ERROR (Status)) { + ReleaseHiiValue (Value); + Value->Type = EFI_IFR_TYPE_UNDEFINED; + } + break; case EFI_IFR_STRING_REF2_OP: