public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: Michael D Kinney <michael.d.kinney@intel.com>
Cc: devel@edk2.groups.io, Ray Ni <ray.ni@intel.com>,
	 Zhichao Gao <zhichao.gao@intel.com>
Subject: Re: [Patch 1/1] ShellPkg/Shell: Do not set end device path if already end
Date: Fri, 9 Dec 2022 18:44:26 +0100	[thread overview]
Message-ID: <CAMj1kXFEAYNV_XMMJ+_dd3XV6qwYcmE8E0ZDTP1XVo9+L+nLhg@mail.gmail.com> (raw)
In-Reply-To: <20221209155943.367-1-michael.d.kinney@intel.com>

On Fri, 9 Dec 2022 at 17:00, Michael D Kinney
<michael.d.kinney@intel.com> wrote:
>
> Update Shell Protocol EfiShellGetMapFromDevicePath() to not
> set the end if the device path if it is already an end of
> entire device path.  This removes a write oprtation that can
> cause failures if the Device Path Protocol is mapped to
> read-only memory.  In general Device Path Protocols should not
> be modified unless the API explicitly states that the device
> path is modified.
>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>

> ---
>  ShellPkg/Application/Shell/ShellProtocol.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
> index 509eb60e40f4..e6d20ab16479 100644
> --- a/ShellPkg/Application/Shell/ShellProtocol.c
> +++ b/ShellPkg/Application/Shell/ShellProtocol.c
> @@ -294,7 +294,13 @@ EfiShellGetMapFromDevicePath (
>        *DevicePath = NextDevicePathNode (*DevicePath);
>      }
>
> -    SetDevicePathEndNode (*DevicePath);
> +    //
> +    // Do not call SetDevicePathEndNode() if the device path node is already the
> +    // end of an entire device path.
> +    //
> +    if (!IsDevicePathEnd (*DevicePath)) {
> +      SetDevicePathEndNode (*DevicePath);
> +    }
>    }
>
>    /*
> --
> 2.37.1.windows.1
>

  reply	other threads:[~2022-12-09 17:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 15:59 [Patch 1/1] ShellPkg/Shell: Do not set end device path if already end Michael D Kinney
2022-12-09 17:44 ` Ard Biesheuvel [this message]
2022-12-12  7:16   ` Gao, Zhichao
2022-12-13 21:22     ` Michael D Kinney

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=CAMj1kXFEAYNV_XMMJ+_dd3XV6qwYcmE8E0ZDTP1XVo9+L+nLhg@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