public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue
@ 2020-05-09  1:58 Feng, YunhuaX
  2020-05-09  2:41 ` Liming Gao
  2020-05-09  2:45 ` Ni, Ray
  0 siblings, 2 replies; 6+ messages in thread
From: Feng, YunhuaX @ 2020-05-09  1:58 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Feng, Bob C, Gao, Liming

if found the next FFS size equal 0xFFFFFF, return NOT_FOUND

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>

Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 BaseTools/Source/C/FMMT/FmmtLib.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c
index cdbee3d629..4fb10ecfe6 100644
--- a/BaseTools/Source/C/FMMT/FmmtLib.c
+++ b/BaseTools/Source/C/FMMT/FmmtLib.c
@@ -1769,10 +1769,13 @@ FvBufFindNextFile (
       (*Key + sizeof (*fhdr)) < fvSize;
       *Key = (UINTN)ALIGN_POINTER (*Key, 8)
     ) {
     fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
     fsize = GetFfsFileLength (fhdr);
+    if (fsize == 0xffffff) {
+      break;
+    }
     if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
           FvbAttributes,
           fhdr->State,
           EFI_FILE_HEADER_VALID
         ) ||
--
2.12.2.windows.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue
  2020-05-09  1:58 [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue Feng, YunhuaX
@ 2020-05-09  2:41 ` Liming Gao
  2020-05-09  2:45 ` Ni, Ray
  1 sibling, 0 replies; 6+ messages in thread
From: Liming Gao @ 2020-05-09  2:41 UTC (permalink / raw)
  To: Feng, YunhuaX, devel@edk2.groups.io; +Cc: Feng, Bob C

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Feng, YunhuaX <yunhuax.feng@intel.com>
> Sent: Saturday, May 9, 2020 9:59 AM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue
> 
> if found the next FFS size equal 0xFFFFFF, return NOT_FOUND
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> 
> Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
> ---
>  BaseTools/Source/C/FMMT/FmmtLib.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c
> index cdbee3d629..4fb10ecfe6 100644
> --- a/BaseTools/Source/C/FMMT/FmmtLib.c
> +++ b/BaseTools/Source/C/FMMT/FmmtLib.c
> @@ -1769,10 +1769,13 @@ FvBufFindNextFile (
>        (*Key + sizeof (*fhdr)) < fvSize;
>        *Key = (UINTN)ALIGN_POINTER (*Key, 8)
>      ) {
>      fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
>      fsize = GetFfsFileLength (fhdr);
> +    if (fsize == 0xffffff) {
> +      break;
> +    }
>      if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
>            FvbAttributes,
>            fhdr->State,
>            EFI_FILE_HEADER_VALID
>          ) ||
> --
> 2.12.2.windows.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue
  2020-05-09  1:58 [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue Feng, YunhuaX
  2020-05-09  2:41 ` Liming Gao
@ 2020-05-09  2:45 ` Ni, Ray
  2020-05-09  3:20   ` Feng, YunhuaX
  1 sibling, 1 reply; 6+ messages in thread
From: Ni, Ray @ 2020-05-09  2:45 UTC (permalink / raw)
  To: devel@edk2.groups.io, Feng, YunhuaX; +Cc: Feng, Bob C, Gao, Liming

Yunhua,
Why the comparison is against 0xFFFFFF not 0xFFFFFFFF?

Is there any existing macro that you can use?

Thanks,
Ray

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Feng, YunhuaX
> Sent: Saturday, May 9, 2020 9:59 AM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [edk2-devel] [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue
> 
> if found the next FFS size equal 0xFFFFFF, return NOT_FOUND
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> 
> Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
> ---
>  BaseTools/Source/C/FMMT/FmmtLib.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c
> index cdbee3d629..4fb10ecfe6 100644
> --- a/BaseTools/Source/C/FMMT/FmmtLib.c
> +++ b/BaseTools/Source/C/FMMT/FmmtLib.c
> @@ -1769,10 +1769,13 @@ FvBufFindNextFile (
>        (*Key + sizeof (*fhdr)) < fvSize;
>        *Key = (UINTN)ALIGN_POINTER (*Key, 8)
>      ) {
>      fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
>      fsize = GetFfsFileLength (fhdr);
> +    if (fsize == 0xffffff) {
> +      break;
> +    }
>      if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
>            FvbAttributes,
>            fhdr->State,
>            EFI_FILE_HEADER_VALID
>          ) ||
> --
> 2.12.2.windows.2
> 
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue
  2020-05-09  2:45 ` Ni, Ray
@ 2020-05-09  3:20   ` Feng, YunhuaX
  2020-05-09  3:28     ` Ni, Ray
  0 siblings, 1 reply; 6+ messages in thread
From: Feng, YunhuaX @ 2020-05-09  3:20 UTC (permalink / raw)
  To: Ni, Ray, devel@edk2.groups.io; +Cc: Feng, Bob C, Gao, Liming

Hi Ray,
   I have checked the  EFI_FFS_FILE_HEADER, the Size only 3 bytes, GetFfsFileLength only return 0xFFFFFF.  I not found existing macro

typedef struct {
EFI_GUID Name;
EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
EFI_FV_FILETYPE Type;
EFI_FFS_FILE_ATTRIBUTES Attributes;
UINT8 Size[3];
EFI_FFS_FILE_STATE State;
} EFI_FFS_FILE_HEADER


-----Original Message-----
From: Ni, Ray <ray.ni@intel.com> 
Sent: Saturday, May 9, 2020 10:46 AM
To: devel@edk2.groups.io; Feng, YunhuaX <yunhuax.feng@intel.com>
Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: RE: [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue

Yunhua,
Why the comparison is against 0xFFFFFF not 0xFFFFFFFF?

Is there any existing macro that you can use?

Thanks,
Ray

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Feng, YunhuaX
> Sent: Saturday, May 9, 2020 9:59 AM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [edk2-devel] [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue
> 
> if found the next FFS size equal 0xFFFFFF, return NOT_FOUND
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> 
> Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
> ---
>  BaseTools/Source/C/FMMT/FmmtLib.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c
> index cdbee3d629..4fb10ecfe6 100644
> --- a/BaseTools/Source/C/FMMT/FmmtLib.c
> +++ b/BaseTools/Source/C/FMMT/FmmtLib.c
> @@ -1769,10 +1769,13 @@ FvBufFindNextFile (
>        (*Key + sizeof (*fhdr)) < fvSize;
>        *Key = (UINTN)ALIGN_POINTER (*Key, 8)
>      ) {
>      fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
>      fsize = GetFfsFileLength (fhdr);
> +    if (fsize == 0xffffff) {
> +      break;
> +    }
>      if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
>            FvbAttributes,
>            fhdr->State,
>            EFI_FILE_HEADER_VALID
>          ) ||
> --
> 2.12.2.windows.2
> 
> 
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue
  2020-05-09  3:20   ` Feng, YunhuaX
@ 2020-05-09  3:28     ` Ni, Ray
  2020-05-09  4:55       ` [edk2-devel] " Feng, YunhuaX
  0 siblings, 1 reply; 6+ messages in thread
From: Ni, Ray @ 2020-05-09  3:28 UTC (permalink / raw)
  To: Feng, YunhuaX, devel@edk2.groups.io; +Cc: Feng, Bob C, Gao, Liming

Ok can you add comments to explain:
1. Why 0xFF instead of 0x00 is used as a condition of break (I am not clear).
2. Why 0xFFFFFF is used (I am clear now thanks for the explanation. Please explain in comments).


> -----Original Message-----
> From: Feng, YunhuaX <yunhuax.feng@intel.com>
> Sent: Saturday, May 9, 2020 11:21 AM
> To: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: RE: [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue
> 
> Hi Ray,
>    I have checked the  EFI_FFS_FILE_HEADER, the Size only 3 bytes, GetFfsFileLength only return 0xFFFFFF.  I not found existing
> macro
> 
> typedef struct {
> EFI_GUID Name;
> EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
> EFI_FV_FILETYPE Type;
> EFI_FFS_FILE_ATTRIBUTES Attributes;
> UINT8 Size[3];
> EFI_FFS_FILE_STATE State;
> } EFI_FFS_FILE_HEADER
> 
> 
> -----Original Message-----
> From: Ni, Ray <ray.ni@intel.com>
> Sent: Saturday, May 9, 2020 10:46 AM
> To: devel@edk2.groups.io; Feng, YunhuaX <yunhuax.feng@intel.com>
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: RE: [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue
> 
> Yunhua,
> Why the comparison is against 0xFFFFFF not 0xFFFFFFFF?
> 
> Is there any existing macro that you can use?
> 
> Thanks,
> Ray
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Feng, YunhuaX
> > Sent: Saturday, May 9, 2020 9:59 AM
> > To: devel@edk2.groups.io
> > Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
> > Subject: [edk2-devel] [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue
> >
> > if found the next FFS size equal 0xFFFFFF, return NOT_FOUND
> >
> > Cc: Bob Feng <bob.c.feng@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> >
> > Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
> > ---
> >  BaseTools/Source/C/FMMT/FmmtLib.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c
> > index cdbee3d629..4fb10ecfe6 100644
> > --- a/BaseTools/Source/C/FMMT/FmmtLib.c
> > +++ b/BaseTools/Source/C/FMMT/FmmtLib.c
> > @@ -1769,10 +1769,13 @@ FvBufFindNextFile (
> >        (*Key + sizeof (*fhdr)) < fvSize;
> >        *Key = (UINTN)ALIGN_POINTER (*Key, 8)
> >      ) {
> >      fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
> >      fsize = GetFfsFileLength (fhdr);
> > +    if (fsize == 0xffffff) {
> > +      break;
> > +    }
> >      if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
> >            FvbAttributes,
> >            fhdr->State,
> >            EFI_FILE_HEADER_VALID
> >          ) ||
> > --
> > 2.12.2.windows.2
> >
> >
> > 
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue
  2020-05-09  3:28     ` Ni, Ray
@ 2020-05-09  4:55       ` Feng, YunhuaX
  0 siblings, 0 replies; 6+ messages in thread
From: Feng, YunhuaX @ 2020-05-09  4:55 UTC (permalink / raw)
  To: devel@edk2.groups.io, Ni, Ray; +Cc: Feng, Bob C, Gao, Liming

Yes , you are right, the condition of break should think about Fv's erase policy, I will update this patch.

Thank you


-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ni, Ray
Sent: Saturday, May 9, 2020 11:28 AM
To: Feng, YunhuaX <yunhuax.feng@intel.com>; devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: Re: [edk2-devel] [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue

Ok can you add comments to explain:
1. Why 0xFF instead of 0x00 is used as a condition of break (I am not clear).
2. Why 0xFFFFFF is used (I am clear now thanks for the explanation. Please explain in comments).


> -----Original Message-----
> From: Feng, YunhuaX <yunhuax.feng@intel.com>
> Sent: Saturday, May 9, 2020 11:21 AM
> To: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming 
> <liming.gao@intel.com>
> Subject: RE: [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next 
> FFS issue
> 
> Hi Ray,
>    I have checked the  EFI_FFS_FILE_HEADER, the Size only 3 bytes, 
> GetFfsFileLength only return 0xFFFFFF.  I not found existing macro
> 
> typedef struct {
> EFI_GUID Name;
> EFI_FFS_INTEGRITY_CHECK IntegrityCheck; EFI_FV_FILETYPE Type; 
> EFI_FFS_FILE_ATTRIBUTES Attributes;
> UINT8 Size[3];
> EFI_FFS_FILE_STATE State;
> } EFI_FFS_FILE_HEADER
> 
> 
> -----Original Message-----
> From: Ni, Ray <ray.ni@intel.com>
> Sent: Saturday, May 9, 2020 10:46 AM
> To: devel@edk2.groups.io; Feng, YunhuaX <yunhuax.feng@intel.com>
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming 
> <liming.gao@intel.com>
> Subject: RE: [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next 
> FFS issue
> 
> Yunhua,
> Why the comparison is against 0xFFFFFF not 0xFFFFFFFF?
> 
> Is there any existing macro that you can use?
> 
> Thanks,
> Ray
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Feng, 
> > YunhuaX
> > Sent: Saturday, May 9, 2020 9:59 AM
> > To: devel@edk2.groups.io
> > Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming 
> > <liming.gao@intel.com>
> > Subject: [edk2-devel] [edk2-staging][PATCH] BaseTools/Fmmt: Fix 
> > found the next FFS issue
> >
> > if found the next FFS size equal 0xFFFFFF, return NOT_FOUND
> >
> > Cc: Bob Feng <bob.c.feng@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> >
> > Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
> > ---
> >  BaseTools/Source/C/FMMT/FmmtLib.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c 
> > b/BaseTools/Source/C/FMMT/FmmtLib.c
> > index cdbee3d629..4fb10ecfe6 100644
> > --- a/BaseTools/Source/C/FMMT/FmmtLib.c
> > +++ b/BaseTools/Source/C/FMMT/FmmtLib.c
> > @@ -1769,10 +1769,13 @@ FvBufFindNextFile (
> >        (*Key + sizeof (*fhdr)) < fvSize;
> >        *Key = (UINTN)ALIGN_POINTER (*Key, 8)
> >      ) {
> >      fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
> >      fsize = GetFfsFileLength (fhdr);
> > +    if (fsize == 0xffffff) {
> > +      break;
> > +    }
> >      if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
> >            FvbAttributes,
> >            fhdr->State,
> >            EFI_FILE_HEADER_VALID
> >          ) ||
> > --
> > 2.12.2.windows.2
> >
> >
> > 
> 
> 





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-09  4:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-09  1:58 [edk2-staging][PATCH] BaseTools/Fmmt: Fix found the next FFS issue Feng, YunhuaX
2020-05-09  2:41 ` Liming Gao
2020-05-09  2:45 ` Ni, Ray
2020-05-09  3:20   ` Feng, YunhuaX
2020-05-09  3:28     ` Ni, Ray
2020-05-09  4:55       ` [edk2-devel] " Feng, YunhuaX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox