Raul Rangel has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/56269 )
Change subject: drivers/usb/acpi/usb_acpi: Fix Coverity errors ......................................................................
drivers/usb/acpi/usb_acpi: Fix Coverity errors
CID 1458232: Null pointer dereferences (REVERSE_INULL) Null-checking "usb_device" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
CID 1458231: Incorrect expression (SIZEOF_MISMATCH) Passing argument "pld" of type "struct acpi_pld *" and argument "4UL /* sizeof (pld) */" to function "memcpy" is suspicious.
TEST=none
Found-by: Coverity CID 1458232, 1458231 Signed-off-by: Raul E Rangel rrangel@chromium.org Change-Id: I8f604a48732457864cc50368205004d2299c4149 --- M src/drivers/usb/acpi/usb_acpi.c 1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/69/56269/1
diff --git a/src/drivers/usb/acpi/usb_acpi.c b/src/drivers/usb/acpi/usb_acpi.c index a0dadff..c3bcfa2 100644 --- a/src/drivers/usb/acpi/usb_acpi.c +++ b/src/drivers/usb/acpi/usb_acpi.c @@ -125,14 +125,16 @@
bool usb_acpi_get_pld(const struct device *usb_device, struct acpi_pld *pld) { - struct drivers_usb_acpi_config *config = usb_device->chip_info; + struct drivers_usb_acpi_config *config;
if (!usb_device || !usb_device->chip_info || usb_device->chip_ops != &drivers_usb_acpi_ops) return false;
+ config = usb_device->chip_info; + if (config->use_custom_pld) - memcpy(pld, &config->custom_pld, sizeof(pld)); + memcpy(pld, &config->custom_pld, sizeof(*pld)); else acpi_pld_fill_usb(pld, config->type, &config->group);