[coreboot-gerrit] Change in coreboot[master]: soc/amd/stoneyridge/northbridge.c: remove unnecessary null c...

Martin Kepplinger (Code Review) gerrit at coreboot.org
Thu Jun 29 11:21:45 CEST 2017


Martin Kepplinger has uploaded this change for review. ( https://review.coreboot.org/20415


Change subject: soc/amd/stoneyridge/northbridge.c: remove unnecessary null check
......................................................................

soc/amd/stoneyridge/northbridge.c: remove unnecessary null check

Checking for NULL here doesn't help here. We *rely* on cdb_dev to exist
directly before this check. Coverity had found this:

*** CID 1376664:  Null pointer dereferences  (REVERSE_INULL)
/src/soc/amd/stoneyridge/northbridge.c: 666 in cpu_bus_scan()
660     	  * this silicon. It is an SOC and can't have  >= 16 APICs, but
661     	  * we will start numbering at 0x10. We also know there is only
662     	  * on physical node (module in AMD speak).
663     	  */
664
665     	lapicid_start = 0x10; /* Get this from devicetree? see comment above. */

CID 1376664:  Null pointer dereferences  (REVERSE_INULL)
Null-checking "cdb_dev" suggests that it may be null, but it has already been
dereferenced on all paths leading to the check.

666     	enable_node = cdb_dev && cdb_dev->enabled;
667     	cpu_bus = dev->link_list;
668
669     	for (j = 0; j <= siblings; j++ ) {
670     		apic_id = lapicid_start + j;
671     		printk(BIOS_SPEW, "lapicid_start 0x%x, node 0x%x,  core 0x%x,  apicid=0x%x\n",

Change-Id: Ic6a53df8b8d1596ad0eb1d8f0fa200cccf9509cf
Signed-off-by: Martin Kepplinger <martink at posteo.de>
---
M src/soc/amd/stoneyridge/northbridge.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/20415/1

diff --git a/src/soc/amd/stoneyridge/northbridge.c b/src/soc/amd/stoneyridge/northbridge.c
index 009c6df..fac966f 100644
--- a/src/soc/amd/stoneyridge/northbridge.c
+++ b/src/soc/amd/stoneyridge/northbridge.c
@@ -676,7 +676,7 @@
 	  */
 
 	lapicid_start = 0x10; /* Get this from devicetree? see comment above. */
-	enable_node = cdb_dev && cdb_dev->enabled;
+	enable_node = cdb_dev->enabled;
 	cpu_bus = dev->link_list;
 
 	for (j = 0 ; j <= siblings ; j++) {

-- 
To view, visit https://review.coreboot.org/20415
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic6a53df8b8d1596ad0eb1d8f0fa200cccf9509cf
Gerrit-Change-Number: 20415
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Kepplinger <martink at posteo.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170629/b73d1af1/attachment-0001.html>


More information about the coreboot-gerrit mailing list