[if gte mso 9]>

[edk2] bug in either CompareGuid or check for 'IsFFS3FV'

Subject: [edk2] bug in either CompareGuid or check for 'IsFFS3FV'

From: "Miller, Carl H" <carl.miller@pnnl.gov>

To: "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>

Date: 2012-12-14 16:06:28

I believe there is a bug  in something i see in the UDK code I have (UDK2010.SR1.UP1). 

It appears to me as though either the ‘CompareGuid’ routine should be

returning the opposite of what it is, or the tests using the variable IsFfs3Fv should be modified:

 

i.e.,:

in FwVol.c

 

  IsFfs3Fv = CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiFirmwareFileSystem3Guid);

...

 

    if (IS_FFS_FILE2 (*FileHeader)) {

      if (!IsFfs3Fv) {

        DEBUG ((EFI_D_ERROR, "It is a FFS3 formatted file: %g in a non-FFS3 formatted FV.\n", &(*FileHeader)->Name));

      }

      FileLength = FFS_FILE2_SIZE (*FileHeader);

...

 

and CompareGuid says:

                //Returns:

                //  =  0  if Guid1 == Guid2

                //  != 0  if Guid1 != Guid2

 

so if FwVolHeader->FileSystemGuid == gEfiFirmwareFileSystem3Guid then

IsFfs3Fv will be 0 if FwVolHeader->FileSystemGuid is a FFS3

 

(which makes 'IsFfs3Fv' seems as though it should have been named 'IsNotFfs3Fv'

 

and therefore the test:

                if (!IsFfs3Fv) {

                                .. do something if not FFS3

 

should be

FwVolHeader->FileSystemGuid

                if (IsFfs3Fv) {

                                .. do something if not FFS3