From a3240c63ec33b704865618aa18eebe64a33a2dba Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Sat, 9 Sep 2017 23:25:33 +0200 Subject: [PATCH] MdeModulePkg/UdfDxe: ASSERT() valid ReadFileInfo Flags for INLINE_DATA req In the ReadFile() function, if "RecordingFlags" is INLINE_DATA, then we cover the following values of "ReadFileInfo->Flags": - READ_FILE_GET_FILESIZE - READ_FILE_ALLOCATE_AND_READ - READ_FILE_SEEK_AND_READ We don't do anything (just proceed to the end of the function) if "ReadFileInfo->Flags" is anything else. In reality the above three values cover the domain of the UDF_READ_FILE_FLAGS enum type fully, and "ReadFileInfo->Flags" is only ever set internally to UdfDxe. Therefore any other flag value would be a bug in UdfDxe. ASSERT() specifically that "ReadFileInfo->Flags" has been set correctly, so that the reader is not left wondering what happens if none of the enum constants match. Cc: Ard Biesheuvel Cc: Eric Dong Cc: Paulo Alcantara Cc: Ruiyu Ni Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Paulo Alcantara Reviewed-by: Ard Biesheuvel --- MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c index 904262a2ba..842c7f8f09 100644 --- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c +++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c @@ -962,6 +962,9 @@ ReadFile ( ); ReadFileInfo->FilePosition += ReadFileInfo->FileDataSize; + } else { + ASSERT (FALSE); + return EFI_INVALID_PARAMETER; } break;