Depending on whether the low-layer produces BlockIo2 protocol, the Fat driver 
doesn't always produce REVISION_2 for FileHandle/DirHandle.
So either we can check both the REVISION_1 and REVISION_2, or we can remove 
this check because the rubbish data can happen to be REVISION_1 or REVISION_2 
but it doesn't mean the rubbish data is valid.

Thanks,
Ray
> -----Original Message-----
> From: Carsey, Jaben [mailto:jaben.car...@intel.com]
> Sent: Thursday, June 11, 2015 1:29 AM
> To: Qiu, Shumin; edk2-devel@lists.sourceforge.net
> Subject: Re: [edk2] [PATCH 2/2] MdePkg/Library/UefiFileHandleLib: Do the
> validation for DirHandle before get file information.
> 
> Why do we need to check against the latest revision?  Can't we use the
> version of the protocol that we need the feature from?
> 
> I like the idea of the check.
> 
> -Jaben
> 
> > -----Original Message-----
> > From: Qiu, Shumin
> > Sent: Wednesday, June 10, 2015 1:22 AM
> > To: edk2-devel@lists.sourceforge.net
> > Cc: Gao, Liming; Carsey, Jaben
> > Subject: [PATCH 2/2] MdePkg/Library/UefiFileHandleLib: Do the validation
> > for DirHandle before get file information.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Qiu Shumin <shumin....@intel.com>
> > ---
> >  MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
> > b/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
> > index 7687ca3..25bb8fb 100644
> > --- a/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
> > +++ b/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
> > @@ -407,7 +407,14 @@ FileHandleIsDirectory (
> >    if (DirHandle == NULL) {
> >      return (EFI_INVALID_PARAMETER);
> >    }
> > -
> > +
> > +  //
> > +  // check whether the DirHandle is valid
> > +  //
> > +  if (DirHandle->Revision != EFI_FILE_PROTOCOL_LATEST_REVISION) {
> > +    return EFI_INVALID_PARAMETER;
> > +  }
> > +
> >    //
> >    // get the file information for DirHandle
> >    //
> > --
> > 1.9.5.msysgit.1
> >
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to