public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Carsey, Jaben" <jaben.carsey@intel.com>
To: "Jim.Dailey@dell.com" <Jim.Dailey@dell.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Ni, Ruiyu" <ruiyu.ni@intel.com>
Subject: Re: Possible UEFI Shell DrvDiag Command Error
Date: Mon, 24 Apr 2017 14:21:01 +0000	[thread overview]
Message-ID: <CB6E33457884FA40993F35157061515C54C0D61D@FMSMSX103.amr.corp.intel.com> (raw)
In-Reply-To: <2c5b3c022bb94ed9bcdbc7e1f2d9c791@ausx13mps339.AMER.DELL.COM>

I would say the shell should not free the GUID.

> -----Original Message-----
> From: Jim.Dailey@dell.com [mailto:Jim.Dailey@dell.com]
> Sent: Monday, April 24, 2017 5:46 AM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>
> Subject: [edk2] Possible UEFI Shell DrvDiag Command Error
> Importance: High
> 
> 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.
> 
> 1234567890123456789012345678901234567890123456789012345678901234567
> 89012
> 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 14:21 UTC|newest]

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

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=CB6E33457884FA40993F35157061515C54C0D61D@FMSMSX103.amr.corp.intel.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