Attention is currently required from: Furquan Shaikh, Maulik V Vaghela, Tim Wawrzynczak. Hello Furquan Shaikh, Maulik V Vaghela, Tim Wawrzynczak,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/56265
to review the following change.
Change subject: drivers/usb/acpi: Replace unneeded `memcpy` use ......................................................................
drivers/usb/acpi: Replace unneeded `memcpy` use
A regular assignment works just as well and also allows type-checking. It also avoids a common mistake where `sizeof` is applied to a pointer to obtain the size of the data it points to, without dereferencing it.
Found-by: Coverity CID 1458231 Change-Id: I7ed05322c3c911f3da4145f81e4d9760a275fec2 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/drivers/usb/acpi/usb_acpi.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/56265/1
diff --git a/src/drivers/usb/acpi/usb_acpi.c b/src/drivers/usb/acpi/usb_acpi.c index a0dadff..8ada939 100644 --- a/src/drivers/usb/acpi/usb_acpi.c +++ b/src/drivers/usb/acpi/usb_acpi.c @@ -132,7 +132,7 @@ return false;
if (config->use_custom_pld) - memcpy(pld, &config->custom_pld, sizeof(pld)); + *pld = config->custom_pld; else acpi_pld_fill_usb(pld, config->type, &config->group);