From 816919b3c8886243111ac636b5371e37f90b7531 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Sat, 18 Jun 2022 12:01:36 +0200 Subject: soc/intel/skylake/irq.c: Fix undefined `memcpy()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original value of the `DevIntConfigPtr` is unknown, and there's no way to be absolutely certain that it actually points to usable memory. Instead of copying the data, update the pointer's address to reference the global variable directly. It is assumed that FSP does not write to the memory pointed by `DevIntConfigPtr`. Confirming this assumption is pointless; one might as well reimplement FSP instead. Change-Id: I90594cc09e3fa2aef98658441c323a44a869635b Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/65217 Reviewed-by: Paul Menzel Reviewed-by: Nico Huber Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier Reviewed-by: Michael Niewöhner --- src/soc/intel/skylake/irq.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/soc/intel') diff --git a/src/soc/intel/skylake/irq.c b/src/soc/intel/skylake/irq.c index 2f0fd97a77..8a9ec813cd 100644 --- a/src/soc/intel/skylake/irq.c +++ b/src/soc/intel/skylake/irq.c @@ -165,20 +165,15 @@ static const SI_PCH_DEVICE_INTERRUPT_CONFIG devintconfig[] = { void soc_irq_settings(FSP_SIL_UPD *params) { - - uint32_t i, intdeventry; + uint32_t i; u8 irq_config[PCH_MAX_IRQ_CONFIG]; const struct device *dev = pcidev_path_on_root(PCH_DEVFN_LPC); const struct soc_intel_skylake_config *config = config_of(dev); - /* Get Device Int Count */ - intdeventry = ARRAY_SIZE(devintconfig); /* update irq table */ - memcpy((SI_PCH_DEVICE_INTERRUPT_CONFIG *) - (uintptr_t)(params->DevIntConfigPtr), devintconfig, intdeventry * - sizeof(SI_PCH_DEVICE_INTERRUPT_CONFIG)); + params->DevIntConfigPtr = (UINT32)(uintptr_t)devintconfig; + params->NumOfDevIntConfig = ARRAY_SIZE(devintconfig); - params->NumOfDevIntConfig = intdeventry; /* PxRC to IRQ programming */ for (i = 0; i < PCH_MAX_IRQ_CONFIG; i++) { switch (i) { -- cgit v1.2.3