From f4d81e03859f3dfed186b6a4314bb0fb59cf14ac Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Wed, 11 Jul 2018 13:54:50 +0200 Subject: Coverity: Fix CID1393978 Fix a typo. Only memcpy into target buffer if pointer is not NULL. Change-Id: I1aa4b2ce1843e53ab6ed2224eaa928fc79ea3b83 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/27446 Tested-by: build bot (Jenkins) Reviewed-by: Philipp Deppenwiese --- src/vendorcode/cavium/bdk/libbdk-hal/device/bdk-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/vendorcode/cavium/bdk/libbdk-hal/device/bdk-device.c b/src/vendorcode/cavium/bdk/libbdk-hal/device/bdk-device.c index a8e65f061a..0df70ebc47 100644 --- a/src/vendorcode/cavium/bdk/libbdk-hal/device/bdk-device.c +++ b/src/vendorcode/cavium/bdk/libbdk-hal/device/bdk-device.c @@ -519,7 +519,7 @@ int bdk_device_add(bdk_node_t node, int ecam, int bus, int dev, int func) { int grow = device_list_max + DEVICE_GROW; bdk_device_t *tmp = malloc(grow * sizeof(bdk_device_t)); - if (!tmp) + if (tmp) memcpy(tmp, device_list, device_list_max * sizeof(bdk_device_t)); free(device_list); if (tmp == NULL) -- cgit v1.2.3