mirror of
				https://gitlab.com/qemu-project/edk2.git
				synced 2025-10-30 07:56:39 +08:00 
			
		
		
		
	IntelFsp2WrapperPkg: Prevent null pointer dereference
Return from `FspsWrapperInitDispatchMode()` if a buffer allocation fails instead of attempting to dereference the pointer. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
This commit is contained in:
		 Michael Kubacki
					Michael Kubacki
				
			
				
					committed by
					
						![mergify[bot]](/assets/img/avatar_default.png) mergify[bot]
						mergify[bot]
					
				
			
			
				
	
			
			
			![mergify[bot]](/assets/img/avatar_default.png) mergify[bot]
						mergify[bot]
					
				
			
						parent
						
							ea59e39c85
						
					
				
				
					commit
					4de80843a7
				
			| @ -421,13 +421,22 @@ FspsWrapperInitDispatchMode ( | ||||
|   EFI_PEI_PPI_DESCRIPTOR                                 *MeasurementExcludedPpiList; | ||||
|  | ||||
|   MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi)); | ||||
|   ASSERT (MeasurementExcludedFvPpi != NULL); | ||||
|   if (MeasurementExcludedFvPpi == NULL) { | ||||
|     ASSERT (MeasurementExcludedFvPpi != NULL); | ||||
|     return EFI_OUT_OF_RESOURCES; | ||||
|   } | ||||
|  | ||||
|   MeasurementExcludedFvPpi->Count          = 1; | ||||
|   MeasurementExcludedFvPpi->Fv[0].FvBase   = PcdGet32 (PcdFspsBaseAddress); | ||||
|   MeasurementExcludedFvPpi->Fv[0].FvLength = ((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspsBaseAddress))->FvLength; | ||||
|  | ||||
|   MeasurementExcludedPpiList = AllocatePool (sizeof (*MeasurementExcludedPpiList)); | ||||
|   ASSERT (MeasurementExcludedPpiList != NULL); | ||||
|   if (MeasurementExcludedPpiList == NULL) { | ||||
|     ASSERT (MeasurementExcludedPpiList != NULL); | ||||
|     FreePool (MeasurementExcludedFvPpi); | ||||
|     return EFI_OUT_OF_RESOURCES; | ||||
|   } | ||||
|  | ||||
|   MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; | ||||
|   MeasurementExcludedPpiList->Guid  = &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid; | ||||
|   MeasurementExcludedPpiList->Ppi   = MeasurementExcludedFvPpi; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user