Skip to content
Permalink
Browse files

ipc: fix ProgInfo usage

We used to use len([]CallInfo) to check both, whether the slice is nil or
whether its length is zero. Since ProgInfo is not a slice, we need a
separate check for nil.
  • Loading branch information...
xairy authored and dvyukov committed Nov 22, 2018
1 parent 97aa259 commit 87815d9d3240b653160e1eb4e5a6931c0c3bd0d9
Showing with 3 additions and 3 deletions.
  1. +2 −2 syz-fuzzer/proc.go
  2. +1 −1 tools/syz-execprog/execprog.go
@@ -122,7 +122,7 @@ func (proc *Proc) triageInput(item *WorkTriage) {
notexecuted := 0
for i := 0; i < signalRuns; i++ {
info := proc.executeRaw(proc.execOptsCover, item.p, StatTriage)
if len(info.Calls) == 0 || len(info.Calls[item.call].Signal) == 0 ||
if info == nil || len(info.Calls) == 0 || len(info.Calls[item.call].Signal) == 0 ||
item.info.Errno == 0 && info.Calls[item.call].Errno != 0 {
// The call was not executed or failed.
notexecuted++
@@ -146,7 +146,7 @@ func (proc *Proc) triageInput(item *WorkTriage) {
func(p1 *prog.Prog, call1 int) bool {
for i := 0; i < minimizeAttempts; i++ {
info := proc.execute(proc.execOptsNoCollide, p1, ProgNormal, StatMinimize)
if len(info.Calls) == 0 || len(info.Calls[call1].Signal) == 0 {
if info == nil || len(info.Calls) == 0 || len(info.Calls[call1].Signal) == 0 {
continue // The call was not executed.
}
inf := info.Calls[call1]
@@ -148,7 +148,7 @@ func (ctx *Context) execute(pid int, env *ipc.Env, entry *prog.LogEntry) {
log.Logf(0, "result: failed=%v hanged=%v err=%v\n\n%s",
failed, hanged, err, output)
}
if len(info.Calls) != 0 {
if info == nil || len(info.Calls) != 0 {
ctx.printCallResults(info)
if *flagHints {
ctx.printHints(entry.P, info)

0 comments on commit 87815d9

Please sign in to comment.
You can’t perform that action at this time.