[edk2-devel] [PATCH v2 2/4] MdeModulePkg/HiiDatabaseDxe: Add check for StringPtr

Dandan Bi dandan.bi at intel.com
Fri Nov 1 02:07:02 UTC 2019


Hi Shenglei,

Please update the commit message and subject before commit, since we have added ASSERT code for this case that the StringPtr cannot be NULL instead of adding check.
With the commit message updated, Reviewed-by: Dandan Bi <dandan.bi at intel.com>.


Thanks,
Dandan

> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Wednesday, October 30, 2019 10:27 PM
> To: devel at edk2.groups.io
> Cc: Bi, Dandan <dandan.bi at intel.com>; Dong, Eric <eric.dong at intel.com>
> Subject: [PATCH v2 2/4] MdeModulePkg/HiiDatabaseDxe: Add check for
> StringPtr
> 
> If the target string doesn't appear in the searched string, StringPtr will be
> NULL. So add a check for that.
> 
> Cc: Dandan Bi <dandan.bi at intel.com>
> Cc: Eric Dong <eric.dong at intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang at intel.com>
> ---
> v2: Instead of returning a value, we add ASSERT to ensure
>     StringPtr is not NULL.
> 
>  MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> index 71ea25bc19bf..19a23fcc951e 100644
> --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> @@ -909,6 +909,7 @@ CompareAndMergeDefaultString (
>    // To find the <AltResp> with AltConfigHdr in AltCfgResp, ignore other
> <AltResp> which follow it.
>    //
>    StringPtr = StrStr (*AltCfgResp, AltConfigHdr);
> +  ASSERT (StringPtr != NULL);
>    StringPtrNext = StrStr (StringPtr + 1, L"&GUID");
>    if (StringPtrNext != NULL) {
>      TempCharA = *StringPtrNext;
> --
> 2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#49788): https://edk2.groups.io/g/devel/message/49788
Mute This Topic: https://groups.io/mt/39808322/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list