public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH EDK2 v1 0/1] MdeModulePkg/FileExplorerLib: Add return value check
@ 2021-01-12  7:06 wenyi,xie
  2021-01-12  7:06 ` [PATCH EDK2 v1 1/1] " wenyi,xie
  0 siblings, 1 reply; 5+ messages in thread
From: wenyi,xie @ 2021-01-12  7:06 UTC (permalink / raw)
  To: devel, jian.j.wang, hao.a.wu, dandan.bi, eric.dong
  Cc: songdongkuang, xiewenyi2

Main Changes :
Add status check after calling LibGetFileHandleFromMenu, if the status is not success, then do not call LibFindFiles.

Wenyi Xie (1):
  MdeModulePkg/FileExplorerLib: Add return value check

 MdeModulePkg/Library/FileExplorerLib/FileExplorer.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

-- 
2.20.1.windows.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH EDK2 v1 1/1] MdeModulePkg/FileExplorerLib: Add return value check
  2021-01-12  7:06 [PATCH EDK2 v1 0/1] MdeModulePkg/FileExplorerLib: Add return value check wenyi,xie
@ 2021-01-12  7:06 ` wenyi,xie
  2021-01-13  6:07   ` Dandan Bi
  0 siblings, 1 reply; 5+ messages in thread
From: wenyi,xie @ 2021-01-12  7:06 UTC (permalink / raw)
  To: devel, jian.j.wang, hao.a.wu, dandan.bi, eric.dong
  Cc: songdongkuang, xiewenyi2

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3113
According to FAT specification, the length of file path
should not larger than 260. When the length exceed 260,
function FatLocateOFile will return EFI_INVALID_PARAMETER
and the parameter FileHandle will be NULL. Then on the
top-level function,an exception happens when the NULL
pointer is passed and be used.
So adding return value check after calling
LibGetFileHandleFromMenu, if return value is not success,
stop calling LibFindFiles.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
---
 MdeModulePkg/Library/FileExplorerLib/FileExplorer.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
index 13a214b06af9..03630a29bc3b 100644
--- a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
+++ b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
@@ -1408,12 +1408,14 @@ LibUpdateFileExplorer (
   if (NewFileContext->IsDir) {
     RemoveEntryList (&NewMenuEntry->Link);
     LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
-    LibGetFileHandleFromMenu (NewMenuEntry, &FileHandle);
-    Status = LibFindFiles (FileHandle, NewFileContext->FileName, NewFileContext->DeviceHandle);
+    Status = LibGetFileHandleFromMenu (NewMenuEntry, &FileHandle);
     if (!EFI_ERROR (Status)) {
-      LibUpdateFileExplorePage ();
-    } else {
-      LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
+      Status = LibFindFiles (FileHandle, NewFileContext->FileName, NewFileContext->DeviceHandle);
+      if (!EFI_ERROR (Status)) {
+        LibUpdateFileExplorePage ();
+      } else {
+        LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
+      }
     }
     LibDestroyMenuEntry (NewMenuEntry);
   }
-- 
2.20.1.windows.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH EDK2 v1 1/1] MdeModulePkg/FileExplorerLib: Add return value check
  2021-01-12  7:06 ` [PATCH EDK2 v1 1/1] " wenyi,xie
@ 2021-01-13  6:07   ` Dandan Bi
  2021-01-14  1:35     ` 回复: [edk2-devel] " gaoliming
       [not found]     ` <1659F55FB44C27DA.15468@groups.io>
  0 siblings, 2 replies; 5+ messages in thread
From: Dandan Bi @ 2021-01-13  6:07 UTC (permalink / raw)
  To: Wenyi Xie, devel@edk2.groups.io, Wang, Jian J, Wu, Hao A,
	Dong, Eric
  Cc: songdongkuang@huawei.com

Reviewed-by: Dandan Bi <dandan.bi@intel.com>



Thanks,
Dandan
> -----Original Message-----
> From: Wenyi Xie <xiewenyi2@huawei.com>
> Sent: Tuesday, January 12, 2021 3:07 PM
> To: devel@edk2.groups.io; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Dong, Eric
> <eric.dong@intel.com>
> Cc: songdongkuang@huawei.com; xiewenyi2@huawei.com
> Subject: [PATCH EDK2 v1 1/1] MdeModulePkg/FileExplorerLib: Add return
> value check
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3113
> According to FAT specification, the length of file path should not larger than
> 260. When the length exceed 260, function FatLocateOFile will return
> EFI_INVALID_PARAMETER and the parameter FileHandle will be NULL. Then
> on the top-level function,an exception happens when the NULL pointer is
> passed and be used.
> So adding return value check after calling LibGetFileHandleFromMenu, if
> return value is not success, stop calling LibFindFiles.
> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
> ---
>  MdeModulePkg/Library/FileExplorerLib/FileExplorer.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
> b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
> index 13a214b06af9..03630a29bc3b 100644
> --- a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
> +++ b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
> @@ -1408,12 +1408,14 @@ LibUpdateFileExplorer (
>    if (NewFileContext->IsDir) {
>      RemoveEntryList (&NewMenuEntry->Link);
>      LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
> -    LibGetFileHandleFromMenu (NewMenuEntry, &FileHandle);
> -    Status = LibFindFiles (FileHandle, NewFileContext->FileName,
> NewFileContext->DeviceHandle);
> +    Status = LibGetFileHandleFromMenu (NewMenuEntry, &FileHandle);
>      if (!EFI_ERROR (Status)) {
> -      LibUpdateFileExplorePage ();
> -    } else {
> -      LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
> +      Status = LibFindFiles (FileHandle, NewFileContext->FileName,
> NewFileContext->DeviceHandle);
> +      if (!EFI_ERROR (Status)) {
> +        LibUpdateFileExplorePage ();
> +      } else {
> +        LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
> +      }
>      }
>      LibDestroyMenuEntry (NewMenuEntry);
>    }
> --
> 2.20.1.windows.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* 回复: [edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/FileExplorerLib: Add return value check
  2021-01-13  6:07   ` Dandan Bi
@ 2021-01-14  1:35     ` gaoliming
       [not found]     ` <1659F55FB44C27DA.15468@groups.io>
  1 sibling, 0 replies; 5+ messages in thread
From: gaoliming @ 2021-01-14  1:35 UTC (permalink / raw)
  To: devel, dandan.bi, 'Wenyi Xie', 'Wang, Jian J',
	'Wu, Hao A', 'Dong, Eric'
  Cc: songdongkuang

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: bounce+27952+70200+4905953+8761045@groups.io
> <bounce+27952+70200+4905953+8761045@groups.io> 代表 Dandan Bi
> 发送时间: 2021年1月13日 14:07
> 收件人: Wenyi Xie <xiewenyi2@huawei.com>; devel@edk2.groups.io; Wang,
> Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Dong, Eric
> <eric.dong@intel.com>
> 抄送: songdongkuang@huawei.com
> 主题: Re: [edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/FileExplorerLib:
> Add return value check
> 
> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
> 
> 
> 
> Thanks,
> Dandan
> > -----Original Message-----
> > From: Wenyi Xie <xiewenyi2@huawei.com>
> > Sent: Tuesday, January 12, 2021 3:07 PM
> > To: devel@edk2.groups.io; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao
> A
> > <hao.a.wu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Dong, Eric
> > <eric.dong@intel.com>
> > Cc: songdongkuang@huawei.com; xiewenyi2@huawei.com
> > Subject: [PATCH EDK2 v1 1/1] MdeModulePkg/FileExplorerLib: Add return
> > value check
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3113
> > According to FAT specification, the length of file path should not larger than
> > 260. When the length exceed 260, function FatLocateOFile will return
> > EFI_INVALID_PARAMETER and the parameter FileHandle will be NULL.
> Then
> > on the top-level function,an exception happens when the NULL pointer is
> > passed and be used.
> > So adding return value check after calling LibGetFileHandleFromMenu, if
> > return value is not success, stop calling LibFindFiles.
> >
> > Cc: Jian J Wang <jian.j.wang@intel.com>
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Cc: Dandan Bi <dandan.bi@intel.com>
> > Cc: Eric Dong <eric.dong@intel.com>
> > Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
> > ---
> >  MdeModulePkg/Library/FileExplorerLib/FileExplorer.c | 12 +++++++-----
> >  1 file changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
> > b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
> > index 13a214b06af9..03630a29bc3b 100644
> > --- a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
> > +++ b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
> > @@ -1408,12 +1408,14 @@ LibUpdateFileExplorer (
> >    if (NewFileContext->IsDir) {
> >      RemoveEntryList (&NewMenuEntry->Link);
> >      LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
> > -    LibGetFileHandleFromMenu (NewMenuEntry, &FileHandle);
> > -    Status = LibFindFiles (FileHandle, NewFileContext->FileName,
> > NewFileContext->DeviceHandle);
> > +    Status = LibGetFileHandleFromMenu (NewMenuEntry, &FileHandle);
> >      if (!EFI_ERROR (Status)) {
> > -      LibUpdateFileExplorePage ();
> > -    } else {
> > -      LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
> > +      Status = LibFindFiles (FileHandle, NewFileContext->FileName,
> > NewFileContext->DeviceHandle);
> > +      if (!EFI_ERROR (Status)) {
> > +        LibUpdateFileExplorePage ();
> > +      } else {
> > +        LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
> > +      }
> >      }
> >      LibDestroyMenuEntry (NewMenuEntry);
> >    }
> > --
> > 2.20.1.windows.1
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* 回复: [edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/FileExplorerLib: Add return value check
       [not found]     ` <1659F55FB44C27DA.15468@groups.io>
@ 2021-01-15  0:44       ` gaoliming
  0 siblings, 0 replies; 5+ messages in thread
From: gaoliming @ 2021-01-15  0:44 UTC (permalink / raw)
  To: devel, gaoliming, dandan.bi, 'Wenyi Xie',
	'Wang, Jian J', 'Wu, Hao A', 'Dong, Eric'
  Cc: songdongkuang

Create PR https://github.com/tianocore/edk2/pull/1357

Thanks
Liming
> -----邮件原件-----
> 发件人: bounce+27952+70264+4905953+8761045@groups.io
> <bounce+27952+70264+4905953+8761045@groups.io> 代表 gaoliming
> 发送时间: 2021年1月14日 9:35
> 收件人: devel@edk2.groups.io; dandan.bi@intel.com; 'Wenyi Xie'
> <xiewenyi2@huawei.com>; 'Wang, Jian J' <jian.j.wang@intel.com>; 'Wu, Hao
> A' <hao.a.wu@intel.com>; 'Dong, Eric' <eric.dong@intel.com>
> 抄送: songdongkuang@huawei.com
> 主题: 回复: [edk2-devel] [PATCH EDK2 v1 1/1]
> MdeModulePkg/FileExplorerLib: Add return value check
> 
> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> 
> > -----邮件原件-----
> > 发件人: bounce+27952+70200+4905953+8761045@groups.io
> > <bounce+27952+70200+4905953+8761045@groups.io> 代表 Dandan Bi
> > 发送时间: 2021年1月13日 14:07
> > 收件人: Wenyi Xie <xiewenyi2@huawei.com>; devel@edk2.groups.io;
> Wang,
> > Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Dong,
> Eric
> > <eric.dong@intel.com>
> > 抄送: songdongkuang@huawei.com
> > 主题: Re: [edk2-devel] [PATCH EDK2 v1 1/1]
> MdeModulePkg/FileExplorerLib:
> > Add return value check
> >
> > Reviewed-by: Dandan Bi <dandan.bi@intel.com>
> >
> >
> >
> > Thanks,
> > Dandan
> > > -----Original Message-----
> > > From: Wenyi Xie <xiewenyi2@huawei.com>
> > > Sent: Tuesday, January 12, 2021 3:07 PM
> > > To: devel@edk2.groups.io; Wang, Jian J <jian.j.wang@intel.com>; Wu,
> Hao
> > A
> > > <hao.a.wu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Dong, Eric
> > > <eric.dong@intel.com>
> > > Cc: songdongkuang@huawei.com; xiewenyi2@huawei.com
> > > Subject: [PATCH EDK2 v1 1/1] MdeModulePkg/FileExplorerLib: Add return
> > > value check
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3113
> > > According to FAT specification, the length of file path should not larger than
> > > 260. When the length exceed 260, function FatLocateOFile will return
> > > EFI_INVALID_PARAMETER and the parameter FileHandle will be NULL.
> > Then
> > > on the top-level function,an exception happens when the NULL pointer is
> > > passed and be used.
> > > So adding return value check after calling LibGetFileHandleFromMenu, if
> > > return value is not success, stop calling LibFindFiles.
> > >
> > > Cc: Jian J Wang <jian.j.wang@intel.com>
> > > Cc: Hao A Wu <hao.a.wu@intel.com>
> > > Cc: Dandan Bi <dandan.bi@intel.com>
> > > Cc: Eric Dong <eric.dong@intel.com>
> > > Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
> > > ---
> > >  MdeModulePkg/Library/FileExplorerLib/FileExplorer.c | 12 +++++++-----
> > >  1 file changed, 7 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
> > > b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
> > > index 13a214b06af9..03630a29bc3b 100644
> > > --- a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
> > > +++ b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
> > > @@ -1408,12 +1408,14 @@ LibUpdateFileExplorer (
> > >    if (NewFileContext->IsDir) {
> > >      RemoveEntryList (&NewMenuEntry->Link);
> > >      LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
> > > -    LibGetFileHandleFromMenu (NewMenuEntry, &FileHandle);
> > > -    Status = LibFindFiles (FileHandle, NewFileContext->FileName,
> > > NewFileContext->DeviceHandle);
> > > +    Status = LibGetFileHandleFromMenu (NewMenuEntry,
> &FileHandle);
> > >      if (!EFI_ERROR (Status)) {
> > > -      LibUpdateFileExplorePage ();
> > > -    } else {
> > > -      LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
> > > +      Status = LibFindFiles (FileHandle, NewFileContext->FileName,
> > > NewFileContext->DeviceHandle);
> > > +      if (!EFI_ERROR (Status)) {
> > > +        LibUpdateFileExplorePage ();
> > > +      } else {
> > > +        LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
> > > +      }
> > >      }
> > >      LibDestroyMenuEntry (NewMenuEntry);
> > >    }
> > > --
> > > 2.20.1.windows.1
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-15  0:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-12  7:06 [PATCH EDK2 v1 0/1] MdeModulePkg/FileExplorerLib: Add return value check wenyi,xie
2021-01-12  7:06 ` [PATCH EDK2 v1 1/1] " wenyi,xie
2021-01-13  6:07   ` Dandan Bi
2021-01-14  1:35     ` 回复: [edk2-devel] " gaoliming
     [not found]     ` <1659F55FB44C27DA.15468@groups.io>
2021-01-15  0:44       ` gaoliming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox