<p>Maximilian Schander has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/22203">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">autoport: Fix nil pointer deref when run without bd82x6x<br><br>When autoport is run on a system without supported southbridge<br>it won't populate the coresponding datastructure. By sanitiy<br>checking after PCI detection it allows to exit clean and<br>provide a sufficient error message.<br><br>Error was:<br>panic: runtime error: invalid memory address or nil pointer dereference<br>[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x4be595]<br>goroutine 1 [running]:<br>main.FIXMEEC(0xc42014af80, 0x14, 0xc42014afe0, 0x1a, 0xc4200a914f, 0x4, 0xc4200a916f, 0xf, 0xc420149e60, 0x28, ...)<br>/coreboot/util/autoport/ec_fixme.go:14 +0x105<br><br>Change-Id: I6b0fcda76d33b0d3a0379c279f492160ce5add84<br>Signed-off-by: Maximilian Schander <maxschander@googlemail.com><br>---<br>M util/autoport/root.go<br>1 file changed, 5 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/22203/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/util/autoport/root.go b/util/autoport/root.go<br>index ca75d4b..efcafed 100644<br>--- a/util/autoport/root.go<br>+++ b/util/autoport/root.go<br>@@ -1,6 +1,7 @@<br> package main<br> <br> import "fmt"<br>+import "os"<br> <br> var supportedPCIDevices map[uint32]PCIDevice = map[uint32]PCIDevice{}<br> var PCIMap map[PCIAddr]PCIDevData = map[PCIAddr]PCIDevData{}<br>@@ -26,6 +27,10 @@<br>                 }<br>             dev.Scan(ctx, pciDev)<br>         }<br>+    if SouthBridge == nil {<br>+              fmt.Println("Could not detect Southbridge. Aborting!")<br>+             os.Exit(1)<br>+   }<br>     dmi := ctx.InfoSource.GetDMI()<br>        if !dmi.IsLaptop {<br>            NoEC(ctx)<br></pre><p>To view, visit <a href="https://review.coreboot.org/22203">change 22203</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/22203"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I6b0fcda76d33b0d3a0379c279f492160ce5add84 </div>
<div style="display:none"> Gerrit-Change-Number: 22203 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Maximilian Schander <maxschander@googlemail.com> </div>