public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ard.biesheuvel@linaro.org>
To: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	 "Gao, Liming" <liming.gao@intel.com>,
	"Wang, Jian J" <jian.j.wang@intel.com>
Subject: Re: [PATCH v1] MdeModulePkg/DxeCore: Please static checker for false report
Date: Mon, 22 Apr 2019 23:25:59 +0200	[thread overview]
Message-ID: <CAKv+Gu9CJ5oVQhGCezVdp0gextgYV-UOrUsibez76UfS2Y6AEg@mail.gmail.com> (raw)
In-Reply-To: <E92EE9817A31E24EB0585FDF735412F5B9C9C2DC@ORSMSX113.amr.corp.intel.com>

On Mon, 22 Apr 2019 at 16:41, Kinney, Michael D
<michael.d.kinney@intel.com> wrote:
>
> Hi Hao,
>
> I think a cleaner fix to this issues is replace both
> ASSERT() statements with the following:
>
>       if (EFI_ERROR (Status) || Entry->Emulator == NULL) {
>         FreePool (Entry);
>         continue;
>       }
>
> We do not expect the emulator protocol to disappear between
> finding the handle and looking up the protocol instance,
> but if it does, the handle can be skipped without ASSERT().
>
> There are several examples of this style in DriverSupport.c.
>
> If we want to avoid the extra Allocate/Free in this error
> condition, then a local variable can be added to get the
> emulator protocol instance and only allocate an
> EMULATOR_ENTRY if the emulator instance is successfully
> found.
>

Is there any way we can #define the OUT modifier to something the
static analyzer understands? (Which static analyzer is this btw?)

Surely, we are not the only project dealing with pointers that are
initialized by reference. Adding code to please the tools should
really be the last resort imo.

  reply	other threads:[~2019-04-22 21:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22  7:24 [PATCH v1] MdeModulePkg/DxeCore: Please static checker for false report Wu, Hao A
2019-04-22 14:40 ` Michael D Kinney
2019-04-22 21:25   ` Ard Biesheuvel [this message]
2019-04-22 21:53     ` Michael D Kinney
2019-04-22 22:02       ` [edk2-devel] " Ard Biesheuvel
2019-04-22 23:14         ` Andrew Fish

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=CAKv+Gu9CJ5oVQhGCezVdp0gextgYV-UOrUsibez76UfS2Y6AEg@mail.gmail.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