public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: <Jim.Dailey@dell.com>
To: <edk2-devel@lists.01.org>
Cc: <ruiyu.ni@intel.com>, <jaben.carsey@intel.com>
Subject: Possible UEFI Shell DrvDiag Command Error
Date: Mon, 24 Apr 2017 12:46:22 +0000	[thread overview]
Message-ID: <2c5b3c022bb94ed9bcdbc7e1f2d9c791@ausx13mps339.AMER.DELL.COM> (raw)

Although this question is about the shell's drvdiag command, the answer
is related to the interpretation of the UEFI specification with respect
to the diagnostics protocol's RunDiagnostics() function.

Ultimately, the question is, is the drvdiag command in error in trying
to free the ErrorType pointer, or is a driver vendor in error when they
return an ErrorType parameter that does not point to memory that was
allocated using gBS->AllocatePool?

The diagnostics protocol's RunDiagnostics() function is partially
described in the UEFI spec like this:

  typedef
  EFI_STATUS
  (EFIAPI *EFI_DRIVER_DIAGNOSTICS2_RUN_DIAGNOSTICS) (
    IN EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *This,
    ...
    OUT EFI_GUID                        **ErrorType,
    OUT UINTN                           *BufferSize,
    OUT CHAR16                          **Buffer
    );

  ...

  ErrorType       A GUID that defines the format of the data returned in
                  Buffer.
  BufferSize      The size, in bytes, of the data returned in Buffer.
  Buffer          A buffer that contains a Null-terminated string plus
                  some additional data whose format is defined by
                  ErrorType. Buffer is allocated by this function with
                  EFI_BOOT_SERVICES.AllocatePool(), and it is the
                  caller's responsibility to free it with a call to
                  EFI_BOOT_SERVICES.FreePool().

After a call to RunDiagnostics, the drvdiag command attempts to free the
ErrorType pointer if it is non-NULL, yet nothing in the UEFI spec says
that this is proper.

123456789012345678901234567890123456789012345678901234567890123456789012
The UEFI spec goes to great length to point out that *Buffer* must be
allocated by the callee using gBS->AllocatePool and that the caller must
use gBS->FreePool to release the memory once it is no longer needed.
However, there is no such language with respect to ErrorType.

So, repeating the question, is the drvdiag command in error in trying
to free the ErrorType pointer, or is a driver vendor in error when they
return an ErrorType parameter that does not point to memory that was
allocated using gBS->AllocatePool?

Regards,
Jim


             reply	other threads:[~2017-04-24 12:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24 12:46 Jim.Dailey [this message]
2017-04-24 14:21 ` Possible UEFI Shell DrvDiag Command Error Carsey, Jaben

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2c5b3c022bb94ed9bcdbc7e1f2d9c791@ausx13mps339.AMER.DELL.COM \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox