public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Feng, YunhuaX" <yunhuax.feng@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Gao, Liming" <liming.gao@intel.com>,
	"Feng, Bob C" <bob.c.feng@intel.com>
Subject: Re: [edk2-staging][PATCH v2] BaseTools/Fmmt: Fix found the next FFS issue
Date: Sat, 9 May 2020 08:28:07 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C530E94@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <BN8PR11MB37938EA2C6704158486DC45B8DA30@BN8PR11MB3793.namprd11.prod.outlook.com>

Yunhua,
I understand that if the ffs size 0 should be specially handled because
otherwise the for-loop will be infinite.

But why do you need to check the size against 0xFFFFFF?

Why the break condition in for-loop " (*Key + sizeof (*fhdr)) < fvSize;" cannot
help when the fsize is too big such as 0xFFFFFF?

I suggest you explain what issue you want to fix and how this fixes the issue in
commit message in detail.

Thanks,
Ray

> -----Original Message-----
> From: Feng, YunhuaX <yunhuax.feng@intel.com>
> Sent: Saturday, May 9, 2020 3:03 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
> Subject: [edk2-staging][PATCH v2] BaseTools/Fmmt: Fix found the next FFS issue
> 
> if the ffs size is invalid, break the iteration and return NOT_FOUND.
> 
> Cc: Ray Ni< ray.ni@intel.com>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> 
> Change-Id: I9e320d6176af350ff208901209f3f6c89e4e1924
> Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
> ---
>  BaseTools/Source/C/FMMT/FmmtLib.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c
> index 9ec511ef06..6858cfe778 100644
> --- a/BaseTools/Source/C/FMMT/FmmtLib.c
> +++ b/BaseTools/Source/C/FMMT/FmmtLib.c
> @@ -1769,10 +1769,17 @@ FvBufFindNextFile (
>        (*Key + sizeof (*fhdr)) < fvSize;
>        *Key = (UINTN)ALIGN_POINTER (*Key, 8)
>      ) {
>      fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
>      fsize = GetFfsFileLength (fhdr);
> +    //
> +    //if the ffs size is invalid, break the loop
> +    //the size defined in EFI_FFS_FILE_HEADER is 3 bytes.
> +    //
> +    if (fsize == (UINTN)((FvbAttributes & EFI_FVB2_ERASE_POLARITY) ? 0xFFFFFF : 0x0)) {
> +      break;
> +    }
>      if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
>            FvbAttributes,
>            fhdr->State,
>            EFI_FILE_HEADER_VALID
>          ) ||
> --
> 2.12.2.windows.2
> 


  reply	other threads:[~2020-05-09  8:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09  7:02 [edk2-staging][PATCH v2] BaseTools/Fmmt: Fix found the next FFS issue Feng, YunhuaX
2020-05-09  8:28 ` Ni, Ray [this message]
2020-05-09  9:15   ` Feng, YunhuaX

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=734D49CCEBEEF84792F5B80ED585239D5C530E94@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