[coreboot-gerrit] Patch set updated for coreboot: drivers/intel/fsp1_1: Simplify union references

Leroy P Leahy (leroy.p.leahy@intel.com) gerrit at coreboot.org
Tue May 17 18:32:29 CEST 2016


Leroy P Leahy (leroy.p.leahy at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14870

-gerrit

commit e3c8ea20a46ba46781a81ae722ef71e12309bef2
Author: Lee Leahy <leroy.p.leahy at intel.com>
Date:   Tue May 17 09:29:09 2016 -0700

    drivers/intel/fsp1_1: Simplify union references
    
    Simplify the union references to enable Coverity to properly process
    the routine.
    
    Found-by: Coverify CID 1349854
    
    TEST=Build and run on Galileo Gen2
    
    Change-Id: I667b9bc5fcde7f68cb9b4c8fa85601998e5c81ff
    Signed-off-by: Lee Leahy <leroy.p.leahy at intel.com>
---
 src/drivers/intel/fsp1_1/fsp_util.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/drivers/intel/fsp1_1/fsp_util.c b/src/drivers/intel/fsp1_1/fsp_util.c
index 49a494f..6e490d3 100644
--- a/src/drivers/intel/fsp1_1/fsp_util.c
+++ b/src/drivers/intel/fsp1_1/fsp_util.c
@@ -29,7 +29,6 @@ FSP_INFO_HEADER *find_fsp(uintptr_t fsp_base_address)
 		EFI_FIRMWARE_VOLUME_EXT_HEADER *fveh;
 		EFI_FIRMWARE_VOLUME_HEADER *fvh;
 		EFI_RAW_SECTION *rs;
-		u8 *u8;
 		u32 u32;
 	} fsp_ptr;
 	static const union {
@@ -50,9 +49,9 @@ FSP_INFO_HEADER *find_fsp(uintptr_t fsp_base_address)
 	}
 
 	/* Locate the file header which follows the FV header. */
-	fsp_ptr.u8 += fsp_ptr.fvh->ExtHeaderOffset;
-	fsp_ptr.u8 += fsp_ptr.fveh->ExtHeaderSize;
-	fsp_ptr.u8 = (u8 *)ALIGN_UP(fsp_ptr.u32, 8);
+	fsp_ptr.u32 += fsp_ptr.fvh->ExtHeaderOffset;
+	fsp_ptr.u32 += fsp_ptr.fveh->ExtHeaderSize;
+	fsp_ptr.u32 = ALIGN_UP(fsp_ptr.u32, 8);
 
 	/* Check the FFS GUID */
 	if ((((u32 *)&fsp_ptr.ffh->Name)[0] != 0x912740BE)
@@ -63,14 +62,14 @@ FSP_INFO_HEADER *find_fsp(uintptr_t fsp_base_address)
 	}
 
 	/* Locate the Raw Section Header */
-	fsp_ptr.u8 += sizeof(EFI_FFS_FILE_HEADER);
+	fsp_ptr.u32 += sizeof(EFI_FFS_FILE_HEADER);
 
 	if (fsp_ptr.rs->Type != EFI_SECTION_RAW) {
 		return (FSP_INFO_HEADER *)ERROR_NO_INFO_HEADER;
 	}
 
 	/* Locate the FSP INFO Header which follows the Raw Header. */
-	fsp_ptr.u8 += sizeof(EFI_RAW_SECTION);
+	fsp_ptr.u32 += sizeof(EFI_RAW_SECTION);
 
 	/* Verify that the FSP base address.*/
 	if (fsp_ptr.fih->ImageBase != fsp_base_address) {



More information about the coreboot-gerrit mailing list