public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ruiyu" <ruiyu.ni@intel.com>
To: "Bi, Dandan" <dandan.bi@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Dong, Eric" <eric.dong@intel.com>,
	Paulo Alcantara <pcacjr@zytor.com>,
	"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH v3 1/3] MdeModulePkg/UdfDxe: Add type cast to fix build failure in VS tools
Date: Tue, 12 Sep 2017 09:40:24 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BA2C0B8@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1505206576-406236-2-git-send-email-dandan.bi@intel.com>

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Thanks/Ray

> -----Original Message-----
> From: Bi, Dandan
> Sent: Tuesday, September 12, 2017 4:56 PM
> To: edk2-devel@lists.01.org
> Cc: Dong, Eric <eric.dong@intel.com>; Paulo Alcantara <pcacjr@zytor.com>;
> Ni, Ruiyu <ruiyu.ni@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: [PATCH v3 1/3] MdeModulePkg/UdfDxe: Add type cast to fix build
> failure in VS tools
> 
> V3: Remove one unnecessay type cast in patch 1.
> Codes:
> if (FilePosition + ExtentLength > ReadFileInfo->FilePosition) {
>   Offset = ReadFileInfo->FilePosition - FilePosition;
>   if (Offset < 0) {
>     Offset = -(Offset)
>   }
> ...
> }
> offset is UINT64 can not < 0, so the code logic may have some issue.
> and Offset = -(Offset) may build failure in some circumstance.
> previously type case Offset to INT64 to fix build block. Now remove the type
> cast. Then can to check the code logic later.
> 
> 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.0
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  .../Universal/Disk/UdfDxe/FileSystemOperations.c         | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
> b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
> index 7d7f722..5c5b5e3 100644
> --- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
> +++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
> @@ -470,11 +470,11 @@ DuplicateFid (
>    OUT  UDF_FILE_IDENTIFIER_DESCRIPTOR  **NewFileIdentifierDesc
>    )
>  {
>    *NewFileIdentifierDesc =
>      (UDF_FILE_IDENTIFIER_DESCRIPTOR *)AllocateCopyPool (
> -      GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierDesc);
> +      (UINTN) GetFidDescriptorLength (FileIdentifierDesc),
> + FileIdentifierDesc);
>  }
> 
>  //
>  // Duplicate either a given File Entry or a given Extended File Entry.
>  //
> @@ -807,20 +807,20 @@ GetAedAdsData (
>    }
> 
>    //
>    // Allocate buffer to read in AED's data.
>    //
> -  *Data = AllocatePool (*Length);
> +  *Data = AllocatePool ((UINTN) (*Length));
>    if (*Data == NULL) {
>      return EFI_OUT_OF_RESOURCES;
>    }
> 
>    return DiskIo->ReadDisk (
>      DiskIo,
>      BlockIo->Media->MediaId,
>      Offset,
> -    *Length,
> +    (UINTN) (*Length),
>      *Data
>      );
>  }
> 
>  //
> @@ -842,11 +842,11 @@ GrowUpBufferToNextAd (
>      *Buffer = AllocatePool (ExtentLength);
>      if (*Buffer == NULL) {
>        return EFI_OUT_OF_RESOURCES;
>      }
>    } else {
> -    *Buffer = ReallocatePool (Length, Length + ExtentLength, *Buffer);
> +    *Buffer = ReallocatePool ((UINTN) Length, (UINTN) (Length +
> + ExtentLength), *Buffer);
>      if (*Buffer == NULL) {
>        return EFI_OUT_OF_RESOURCES;
>      }
>    }
> 
> @@ -931,29 +931,29 @@ ReadFile (
>        ReadFileInfo->ReadLength = Length;
>      } else if (ReadFileInfo->Flags == READ_FILE_ALLOCATE_AND_READ) {
>        //
>        // Allocate buffer for starting read data.
>        //
> -      ReadFileInfo->FileData = AllocatePool (Length);
> +      ReadFileInfo->FileData = AllocatePool ((UINTN) Length);
>        if (ReadFileInfo->FileData == NULL) {
>          return EFI_OUT_OF_RESOURCES;
>        }
> 
>        //
>        // Read all inline data into ReadFileInfo->FileData
>        //
> -      CopyMem (ReadFileInfo->FileData, Data, Length);
> +      CopyMem (ReadFileInfo->FileData, Data, (UINTN) Length);
>        ReadFileInfo->ReadLength = Length;
>      } else if (ReadFileInfo->Flags == READ_FILE_SEEK_AND_READ) {
>        //
>        // If FilePosition is non-zero, seek file to FilePosition, read
>        // FileDataSize bytes and then updates FilePosition.
>        //
>        CopyMem (
>          ReadFileInfo->FileData,
>          (VOID *)((UINT8 *)Data + ReadFileInfo->FilePosition),
> -        ReadFileInfo->FileDataSize
> +        (UINTN) ReadFileInfo->FileDataSize
>          );
> 
>        ReadFileInfo->FilePosition += ReadFileInfo->FileDataSize;
>      }
> 
> @@ -1097,11 +1097,11 @@ ReadFile (
>          //
>          Status = DiskIo->ReadDisk (
>            DiskIo,
>            BlockIo->Media->MediaId,
>            Offset + MultU64x32 (Lsn, LogicalBlockSize),
> -          DataLength,
> +          (UINTN) DataLength,
>            (VOID *)((UINT8 *)ReadFileInfo->FileData +
>                     DataOffset)
>            );
>          if (EFI_ERROR (Status)) {
>            goto Error_Read_Disk_Blk;
> --
> 1.9.5.msysgit.1



  reply	other threads:[~2017-09-12  9:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-12  8:56 [PATCH v3 0/3] Fix VS tool chain build failure Dandan Bi
2017-09-12  8:56 ` [PATCH v3 1/3] MdeModulePkg/UdfDxe: Add type cast to fix build failure in VS tools Dandan Bi
2017-09-12  9:40   ` Ni, Ruiyu [this message]
2017-09-12  8:56 ` [PATCH v3 2/3] MdeModulePkg/UdfDxe: Initialize the array after declaration Dandan Bi
2017-09-12  9:40   ` Ni, Ruiyu
2017-09-12  8:56 ` [PATCH v3 3/3] MdeModulePkg/PartitionDxe: " Dandan Bi
2017-09-12  9:40   ` Ni, Ruiyu
2017-09-12  9:30 ` [PATCH v3 0/3] Fix VS tool chain build failure Zeng, Star

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=734D49CCEBEEF84792F5B80ED585239D5BA2C0B8@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox