[edk2-devel] [Patch 1/1] ShellPkg/Shell: Do not set end device path if already end

Gao, Zhichao zhichao.gao at intel.com
Mon Dec 12 07:16:56 UTC 2022


Reviewed-by: Zhichao Gao <zhichao.gao at intel.com>

Thanks,
Zhichao

> -----Original Message-----
> From: Ard Biesheuvel <ardb at kernel.org>
> Sent: Saturday, December 10, 2022 1:44 AM
> To: Kinney, Michael D <michael.d.kinney at intel.com>
> Cc: devel at edk2.groups.io; Ni, Ray <ray.ni at intel.com>; Gao, Zhichao
> <zhichao.gao at intel.com>
> Subject: Re: [Patch 1/1] ShellPkg/Shell: Do not set end device path if already
> end
> 
> On Fri, 9 Dec 2022 at 17:00, Michael D Kinney <michael.d.kinney at 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 at kernel.org>
> > Cc: Ray Ni <ray.ni at intel.com>
> > Cc: Zhichao Gao <zhichao.gao at intel.com>
> > Signed-off-by: Michael D Kinney <michael.d.kinney at intel.com>
> 
> Reviewed-by: Ard Biesheuvel <ardb at 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
> >


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97246): https://edk2.groups.io/g/devel/message/97246
Mute This Topic: https://groups.io/mt/95562992/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list