Reviewed-by: Hao Wu <[email protected]> Best Regards, Hao Wu
> -----Original Message----- > From: Bi, Dandan > Sent: Friday, June 24, 2016 1:43 PM > To: [email protected] > Cc: Dong, Eric; Wu, Hao A > Subject: [patch] MdeModulePkg/HiiDatabaseDxe: Add ASSERT before using the > pointer 'String' > > The 'Sting' is returned by the function GetUnicodeStringTextAndSize. > If it is NULL, function GetUnicodeStringTextAndSize will return > EFI_OUT_OF_RESOURCES, and error handling codes will cover it. > So the pointer 'Sting' can not be NULL when using it. > So we can add the ASSERT codes. > > Cc: Eric Dong <[email protected]> > Cc: Hao Wu <[email protected]> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Dandan Bi <[email protected]> > --- > MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c | 8 ++++- > --- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c > b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c > index 03f8141..6682319 100644 > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c > @@ -873,11 +873,11 @@ GetStringIdFromString ( > // > Status = GetUnicodeStringTextAndSize (StringTextPtr, &StringSize, > &String); > if (EFI_ERROR (Status)) { > goto Done; > } > - > + ASSERT (String != NULL); > if (StrCmp(KeywordValue, String) == 0) { > *StringId = CurrentStringId; > goto Done; > } > BlockSize += Offset + StringSize; > @@ -893,11 +893,11 @@ GetStringIdFromString ( > // > Status = GetUnicodeStringTextAndSize (StringTextPtr, &StringSize, > &String); > if (EFI_ERROR (Status)) { > goto Done; > } > - > + ASSERT (String != NULL); > if (StrCmp(KeywordValue, String) == 0) { > *StringId = CurrentStringId; > goto Done; > } > BlockSize += Offset + StringSize; > @@ -912,11 +912,11 @@ GetStringIdFromString ( > for (Index = 0; Index < StringCount; Index++) { > Status = GetUnicodeStringTextAndSize (StringTextPtr, &StringSize, > &String); > if (EFI_ERROR (Status)) { > goto Done; > } > - > + ASSERT (String != NULL); > BlockSize += StringSize; > if (StrCmp(KeywordValue, String) == 0) { > *StringId = CurrentStringId; > goto Done; > } > @@ -937,11 +937,11 @@ GetStringIdFromString ( > for (Index = 0; Index < StringCount; Index++) { > Status = GetUnicodeStringTextAndSize (StringTextPtr, &StringSize, > &String); > if (EFI_ERROR (Status)) { > goto Done; > } > - > + ASSERT (String != NULL); > BlockSize += StringSize; > if (StrCmp(KeywordValue, String) == 0) { > *StringId = CurrentStringId; > goto Done; > } > -- > 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

