[coreboot-gerrit] Change in coreboot[master]: Coverity: Fix CID1393978

Philipp Deppenwiese (Code Review) gerrit at coreboot.org
Thu Jul 12 17:21:44 CEST 2018


Philipp Deppenwiese has submitted this change and it was merged. ( https://review.coreboot.org/27446 )

Change subject: Coverity: Fix CID1393978
......................................................................

Coverity: Fix CID1393978

Fix a typo.
Only memcpy into target buffer if pointer is not NULL.

Change-Id: I1aa4b2ce1843e53ab6ed2224eaa928fc79ea3b83
Signed-off-by: Patrick Rudolph <patrick.rudolph at 9elements.com>
Reviewed-on: https://review.coreboot.org/27446
Tested-by: build bot (Jenkins) <no-reply at coreboot.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki at gmail.com>
---
M src/vendorcode/cavium/bdk/libbdk-hal/device/bdk-device.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  build bot (Jenkins): Verified
  Philipp Deppenwiese: Looks good to me, approved



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 a8e65f0..0df70eb 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 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)

-- 
To view, visit https://review.coreboot.org/27446
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1aa4b2ce1843e53ab6ed2224eaa928fc79ea3b83
Gerrit-Change-Number: 27446
Gerrit-PatchSet: 2
Gerrit-Owner: Patrick Rudolph <patrick.rudolph at 9elements.com>
Gerrit-Reviewer: Paul Menzel <paulepanter at users.sourceforge.net>
Gerrit-Reviewer: Philipp Deppenwiese <zaolin.daisuki at gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply at coreboot.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180712/95861bc3/attachment.html>


More information about the coreboot-gerrit mailing list