MdeModulePkg/UdfDxe: replace zero-init of local variables with ZeroMem()

In edk2, initialization of local variables is forbidden, both for
stylistic reasons and because such initialization may generate calls to
compiler intrinsics.

For the following initialization in UdfRead():

  CHAR16                          FileName[UDF_FILENAME_LENGTH] = { 0 };

clang-3.8 generates a memset() call, when building UdfDxe for IA32, which
then fails to link.

Replace the initialization with ZeroMem().

Do the same to "FilePath" in UdfOpen().

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Paulo Alcantara <pcacjr@zytor.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Paulo Alcantara <pcacjr@zytor.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
Laszlo Ersek 2017-09-09 23:41:01 +02:00
parent 131fd40ffc
commit eb928b17c5
1 changed files with 4 additions and 2 deletions

View File

@ -176,11 +176,12 @@ UdfOpen (
EFI_STATUS Status;
PRIVATE_UDF_FILE_DATA *PrivFileData;
PRIVATE_UDF_SIMPLE_FS_DATA *PrivFsData;
CHAR16 FilePath[UDF_PATH_LENGTH] = { 0 };
CHAR16 FilePath[UDF_PATH_LENGTH];
UDF_FILE_INFO File;
PRIVATE_UDF_FILE_DATA *NewPrivFileData;
CHAR16 *TempFileName;
ZeroMem (FilePath, sizeof FilePath);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
if (This == NULL || NewHandle == NULL || FileName == NULL) {
@ -324,10 +325,11 @@ UdfRead (
UDF_FILE_INFO FoundFile;
UDF_FILE_IDENTIFIER_DESCRIPTOR *NewFileIdentifierDesc;
VOID *NewFileEntryData;
CHAR16 FileName[UDF_FILENAME_LENGTH] = { 0 };
CHAR16 FileName[UDF_FILENAME_LENGTH];
UINT64 FileSize;
UINT64 BufferSizeUint64;
ZeroMem (FileName, sizeof FileName);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
if (This == NULL || BufferSize == NULL || (*BufferSize != 0 &&