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