For FadtMinorRevision and X_DsdtAddress, I don't think they are required 
section. Maybe we should consider check the length before check them. As I 
know, the OVMF's FACP table doesn't have the section after flag.

Thanks,
Zhichao

> -----Original Message-----
> From: Krzysztof Koch [mailto:[email protected]]
> Sent: Thursday, August 15, 2019 9:11 PM
> To: [email protected]
> Cc: Carsey, Jaben <[email protected]>; Ni, Ray <[email protected]>;
> Gao, Zhichao <[email protected]>; [email protected];
> [email protected]; [email protected]
> Subject: [PATCH v1 03/11] ShellPkg: acpiview: FADT: Validate global pointer
> before use
> 
> Check if global pointers have been successfully updated before they are
> used for further table parsing.
> 
> Signed-off-by: Krzysztof Koch <[email protected]>
> ---
> 
> Notes:
>     v1:
>     - Test against NULL pointers [Krzysztof]
> 
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
> | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.
> c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.
> c
> index
> e40c9ef8ee4b3285faf8c6edf3cb6236ee367397..e218e45926abced1096e75441
> e22108db7a3a811 100644
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.
> c
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtPars
> +++ er.c
> @@ -203,6 +203,20 @@ ParseAcpiFadt (
>      PARSER_PARAMS (FadtParser)
>      );
> 
> +  // Check if the values used to control the parsing logic have been
> + // successfully read.
> +  if ((DsdtAddress == NULL)       ||
> +      (FadtMinorRevision == NULL) ||
> +      (X_DsdtAddress == NULL)) {
> +    IncrementErrorCount ();
> +    Print (
> +      L"ERROR: Insufficient table length. AcpiTableLength = %d. " \
> +        L"FADT parsing aborted.\n",
> +      AcpiTableLength
> +      );
> +    return;
> +  }
> +
>    if (Trace) {
>      Print (L"\nSummary:\n");
>      PrintFieldName (2, L"FADT Version");
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 


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

View/Reply Online (#45798): https://edk2.groups.io/g/devel/message/45798
Mute This Topic: https://groups.io/mt/32886566/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to