From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel-01 <edk2-devel@lists.01.org>
Cc: Chao Zhang <chao.b.zhang@intel.com>,
Eric Dong <eric.dong@intel.com>,
Jaben Carsey <jaben.carsey@intel.com>,
Jiaxin Wu <jiaxin.wu@intel.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Liming Gao <liming.gao@intel.com>,
Michael D Kinney <michael.d.kinney@intel.com>,
Roman Bacik <roman.bacik@broadcom.com>,
Ruiyu Ni <ruiyu.ni@intel.com>, Siyuan Fu <siyuan.fu@intel.com>,
Star Zeng <star.zeng@intel.com>
Subject: [PATCH v2 0/7] UefiLib: centralize OpenFileByDevicePath() and fix its bugs
Date: Fri, 3 Aug 2018 14:15:30 +0200 [thread overview]
Message-ID: <20180803121537.32123-1-lersek@redhat.com> (raw)
Repo: https://github.com/lersek/edk2.git
Branch: open_file_by_devpath_tiano_1008_v2
This is version 2 of the patch set that was originally posted at:
https://lists.01.org/pipermail/edk2-devel/2018-July/027253.html
for <https://bugzilla.tianocore.org/show_bug.cgi?id=1008>.
Changes are noted on every patch.
The cumulative code difference is very small (not counting the
FrameworkUefiLib copy of the function), so I'm including it here for
easier review:
> diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/UefiLib.h
> index 2468bf2aee80..f950f1c9c648 100644
> --- a/MdePkg/Include/Library/UefiLib.h
> +++ b/MdePkg/Include/Library/UefiLib.h
> @@ -1554,9 +1554,11 @@ EfiLocateProtocolBuffer (
> traversal is stopped with an error, and a NULL EFI_FILE_PROTOCOL is output.
>
> @param[in,out] FilePath On input, the device path to the file or directory
> - to open or create. On output, FilePath points one
> - past the last node in the original device path that
> - has been successfully processed. FilePath is set on
> + to open or create. The caller is responsible for
> + ensuring that the device path pointed-to by FilePath
> + is well-formed. On output, FilePath points one past
> + the last node in the original device path that has
> + been successfully processed. FilePath is set on
> output even if EfiOpenFileByDevicePath() returns an
> error.
>
> diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.c
> index d3e290178cd9..7bcac5613768 100644
> --- a/MdePkg/Library/UefiLib/UefiLib.c
> +++ b/MdePkg/Library/UefiLib/UefiLib.c
> @@ -1751,9 +1751,11 @@ EfiLocateProtocolBuffer (
> traversal is stopped with an error, and a NULL EFI_FILE_PROTOCOL is output.
>
> @param[in,out] FilePath On input, the device path to the file or directory
> - to open or create. On output, FilePath points one
> - past the last node in the original device path that
> - has been successfully processed. FilePath is set on
> + to open or create. The caller is responsible for
> + ensuring that the device path pointed-to by FilePath
> + is well-formed. On output, FilePath points one past
> + the last node in the original device path that has
> + been successfully processed. FilePath is set on
> output even if EfiOpenFileByDevicePath() returns an
> error.
>
> @@ -1808,6 +1810,10 @@ EfiOpenFileByDevicePath (
> EFI_HANDLE FileSystemHandle;
> EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem;
> EFI_FILE_PROTOCOL *LastFile;
> + FILEPATH_DEVICE_PATH *FilePathNode;
> + CHAR16 *AlignedPathName;
> + CHAR16 *PathName;
> + EFI_FILE_PROTOCOL *NextFile;
>
> if (File == NULL) {
> return EFI_INVALID_PARAMETER;
> @@ -1854,15 +1860,6 @@ EfiOpenFileByDevicePath (
> // Traverse the device path nodes relative to the filesystem.
> //
> while (!IsDevicePathEnd (*FilePath)) {
> - //
> - // Keep local variables that relate to the current device path node tightly
> - // scoped.
> - //
> - FILEPATH_DEVICE_PATH *FilePathNode;
> - CHAR16 *AlignedPathName;
> - CHAR16 *PathName;
> - EFI_FILE_PROTOCOL *NextFile;
> -
> if (DevicePathType (*FilePath) != MEDIA_DEVICE_PATH ||
> DevicePathSubType (*FilePath) != MEDIA_FILEPATH_DP) {
> Status = EFI_INVALID_PARAMETER;
> @@ -1942,6 +1939,10 @@ EfiOpenFileByDevicePath (
> CloseLastFile:
> LastFile->Close (LastFile);
>
> + //
> + // We are on the error path; we must have set an error Status for returning
> + // to the caller.
> + //
> ASSERT (EFI_ERROR (Status));
> return Status;
> }
> diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c
> index 312a92d7461a..aef85c470143 100644
> --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c
> +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c
> @@ -163,7 +163,7 @@ UpdatePage(
>
> gSecureBootPrivateData->FileContext->FileName = FileName;
>
> - EfiOpenFileByDevicePath(
> + EfiOpenFileByDevicePath (
> &FilePath,
> &gSecureBootPrivateData->FileContext->FHandle,
> EFI_FILE_MODE_READ,
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Roman Bacik <roman.bacik@broadcom.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Thanks,
Laszlo
Laszlo Ersek (7):
MdePkg/UefiLib: introduce EfiOpenFileByDevicePath()
IntelFrameworkPkg/FrameworkUefiLib: introduce
EfiOpenFileByDevicePath()
MdeModulePkg/RamDiskDxe: replace OpenFileByDevicePath() with UefiLib
API
NetworkPkg/TlsAuthConfigDxe: replace OpenFileByDevicePath() with
UefiLib API
SecurityPkg/SecureBootConfigDxe: replace OpenFileByDevicePath() with
UefiLib API
ShellPkg/UefiShellLib: drop DeviceHandle param of
ShellOpenFileByDevicePath()
ShellPkg/UefiShellLib: rebase ShellOpenFileByDevicePath() to UefiLib
API
IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUefiLib.inf | 1 +
IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c | 227 ++++++++++++++++++++
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf | 1 -
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskFileExplorer.c | 140 ------------
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c | 2 +-
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h | 39 ----
MdePkg/Include/Library/UefiLib.h | 88 ++++++++
MdePkg/Library/UefiLib/UefiLib.c | 227 ++++++++++++++++++++
MdePkg/Library/UefiLib/UefiLib.inf | 1 +
NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf | 1 -
NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c | 141 +-----------
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf | 1 -
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c | 151 +------------
ShellPkg/Include/Library/ShellLib.h | 2 -
ShellPkg/Library/UefiShellLib/UefiShellLib.c | 118 +---------
ShellPkg/Library/UefiShellLib/UefiShellLib.inf | 3 +-
16 files changed, 552 insertions(+), 591 deletions(-)
--
2.14.1.3.gb7cf6e02401b
next reply other threads:[~2018-08-03 12:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-03 12:15 Laszlo Ersek [this message]
2018-08-03 12:15 ` [PATCH v2 1/7] MdePkg/UefiLib: introduce EfiOpenFileByDevicePath() Laszlo Ersek
2018-08-06 2:03 ` Ni, Ruiyu
2018-08-03 12:15 ` [PATCH v2 2/7] IntelFrameworkPkg/FrameworkUefiLib: " Laszlo Ersek
2018-08-03 12:15 ` [PATCH v2 3/7] MdeModulePkg/RamDiskDxe: replace OpenFileByDevicePath() with UefiLib API Laszlo Ersek
2018-08-03 12:15 ` [PATCH v2 4/7] NetworkPkg/TlsAuthConfigDxe: " Laszlo Ersek
2018-08-03 12:15 ` [PATCH v2 5/7] SecurityPkg/SecureBootConfigDxe: " Laszlo Ersek
2018-08-07 12:16 ` Zhang, Chao B
2018-08-03 12:15 ` [PATCH v2 6/7] ShellPkg/UefiShellLib: drop DeviceHandle param of ShellOpenFileByDevicePath() Laszlo Ersek
2018-08-06 2:04 ` Ni, Ruiyu
2018-08-03 12:15 ` [PATCH v2 7/7] ShellPkg/UefiShellLib: rebase ShellOpenFileByDevicePath() to UefiLib API Laszlo Ersek
2018-08-06 2:04 ` Ni, Ruiyu
2018-08-03 16:09 ` [PATCH v2 0/7] UefiLib: centralize OpenFileByDevicePath() and fix its bugs Laszlo Ersek
2018-08-09 13:30 ` Laszlo Ersek
2018-08-15 17:20 ` Laszlo Ersek
2018-08-15 17:42 ` Gao, Liming
2018-08-16 18:12 ` Laszlo Ersek
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=20180803121537.32123-1-lersek@redhat.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