Attention is currently required from: Maulik V Vaghela, John Zhao. Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/56024 )
Change subject: drivers/usb/acpi: Create function to get PLD information ......................................................................
Patch Set 6:
(1 comment)
File src/drivers/usb/acpi/usb_acpi.c:
https://review.coreboot.org/c/coreboot/+/56024/comment/8fdc7552_763249d2 PS6, Line 129: struct acpi_pld pld; : : if (!usb_device || !usb_device->chip_info || : usb_device->chip_ops != &drivers_usb_acpi_ops) : return NULL; : : if (config->use_custom_pld) : memcpy(&pld, &config->custom_pld, sizeof(pld)); : else : acpi_pld_fill_usb(&pld, config->type, &config->group); : : return &pld; You can't return a reference to an object on the stack, it will cease to exist when the function returns.
Since the object is so large, maybe this should be malloc'd if it it's not the custom one, i.e.:
``` struct drivers_usb_acpi_config *config; struct acpi_pld *pld;
if (!usb_device || !usb_device->chip_info || usb_device->chip_ops != &drivers_usb_acpi_ops) return NULL;
config = usb_device->chip_info; if (config->use_custom_pld) return &config->custom_pld;
pld = malloc(sizeof(*pld)); if (acpi_pld_fill_usb(pld, config->type, &config->group)) return NULL;
return pld; ```