回复: [edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/FileExplorerLib: Add return value check

gaoliming gaoliming at byosoft.com.cn
Thu Jan 14 01:35:26 UTC 2021


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

> -----邮件原件-----
> 发件人: bounce+27952+70200+4905953+8761045 at groups.io
> <bounce+27952+70200+4905953+8761045 at groups.io> 代表 Dandan Bi
> 发送时间: 2021年1月13日 14:07
> 收件人: Wenyi Xie <xiewenyi2 at huawei.com>; devel at edk2.groups.io; Wang,
> Jian J <jian.j.wang at intel.com>; Wu, Hao A <hao.a.wu at intel.com>; Dong, Eric
> <eric.dong at intel.com>
> 抄送: songdongkuang at huawei.com
> 主题: Re: [edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/FileExplorerLib:
> Add return value check
> 
> Reviewed-by: Dandan Bi <dandan.bi at intel.com>
> 
> 
> 
> Thanks,
> Dandan
> > -----Original Message-----
> > From: Wenyi Xie <xiewenyi2 at huawei.com>
> > Sent: Tuesday, January 12, 2021 3:07 PM
> > To: devel at edk2.groups.io; Wang, Jian J <jian.j.wang at intel.com>; Wu, Hao
> A
> > <hao.a.wu at intel.com>; Bi, Dandan <dandan.bi at intel.com>; Dong, Eric
> > <eric.dong at intel.com>
> > Cc: songdongkuang at huawei.com; xiewenyi2 at 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 at intel.com>
> > Cc: Hao A Wu <hao.a.wu at intel.com>
> > Cc: Dandan Bi <dandan.bi at intel.com>
> > Cc: Eric Dong <eric.dong at intel.com>
> > Signed-off-by: Wenyi Xie <xiewenyi2 at 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
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70264): https://edk2.groups.io/g/devel/message/70264
Mute This Topic: https://groups.io/mt/79666671/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