summaryrefslogtreecommitdiff
path: root/util/autoport/root.go
diff options
context:
space:
mode:
authorMaximilian Schander <maxschander@googlemail.com>2017-10-27 15:26:15 +0200
committerPatrick Georgi <pgeorgi@google.com>2017-11-07 12:31:21 +0000
commit12217f2878990ef7f754596eda687b1e50166e24 (patch)
treec8f304fef5dfd61ceb77b438c4174c94b02572bf /util/autoport/root.go
parent67b3268fac933c33a00a036dab4dfa366ffc3639 (diff)
downloadcoreboot-12217f2878990ef7f754596eda687b1e50166e24.tar.xz
autoport: Fix nil pointer deref when run without bd82x6x
When autoport is run on a system without supported southbridge it won't populate the coresponding data structure. By sanitiy checking after PCI detection autoport can exit cleanly and provide a sufficient error message. Error was: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x4be595] goroutine 1 [running]: main.FIXMEEC(0xc42014af80, 0x14, 0xc42014afe0, 0x1a, 0xc4200a914f, 0x4, 0xc4200a916f, 0xf, 0xc420149e60, 0x28, ...) /coreboot/util/autoport/ec_fixme.go:14 +0x105 Change-Id: I6b0fcda76d33b0d3a0379c279f492160ce5add84 Signed-off-by: Maximilian Schander <maxschander@googlemail.com> Reviewed-on: https://review.coreboot.org/22203 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Diffstat (limited to 'util/autoport/root.go')
-rw-r--r--util/autoport/root.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/autoport/root.go b/util/autoport/root.go
index ca75d4b385..7e9e814506 100644
--- a/util/autoport/root.go
+++ b/util/autoport/root.go
@@ -1,6 +1,7 @@
package main
import "fmt"
+import "os"
var supportedPCIDevices map[uint32]PCIDevice = map[uint32]PCIDevice{}
var PCIMap map[PCIAddr]PCIDevData = map[PCIAddr]PCIDevData{}
@@ -26,6 +27,10 @@ func ScanRoot(ctx Context) {
}
dev.Scan(ctx, pciDev)
}
+ if SouthBridge == nil {
+ fmt.Println("Could not detect southbridge. Aborting!")
+ os.Exit(1)
+ }
dmi := ctx.InfoSource.GetDMI()
if !dmi.IsLaptop {
NoEC(ctx)