diff options
| -rw-r--r-- | dashboard/app/main.go | 2 | ||||
| -rw-r--r-- | pkg/build/build_test.go | 2 | ||||
| -rw-r--r-- | pkg/csource/csource.go | 2 | ||||
| -rw-r--r-- | pkg/host/syscalls_linux.go | 4 | ||||
| -rw-r--r-- | prog/rand.go | 4 | ||||
| -rw-r--r-- | syz-manager/manager.go | 4 |
6 files changed, 9 insertions, 9 deletions
diff --git a/dashboard/app/main.go b/dashboard/app/main.go index 5bdceec24..8df3a787e 100644 --- a/dashboard/app/main.go +++ b/dashboard/app/main.go @@ -363,7 +363,7 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error Caption: fmt.Sprintf("Crashes (%d)", bug.NumCrashes), } for _, crash := range crashesTable.Crashes { - if len(crash.Maintainers) != 0 { + if crash.Maintainers != "" { crashesTable.HasMaintainers = true break } diff --git a/pkg/build/build_test.go b/pkg/build/build_test.go index 54b2efb49..697e29dfd 100644 --- a/pkg/build/build_test.go +++ b/pkg/build/build_test.go @@ -23,7 +23,7 @@ func TestCompilerIdentity(t *testing.T) { if err != nil { t.Fatalf("failed: %v", err) } - if len(id) == 0 { + if id == "" { t.Fatalf("identity is empty") } if strings.Contains(id, "\n") { diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go index 2799920e3..4126e2b02 100644 --- a/pkg/csource/csource.go +++ b/pkg/csource/csource.go @@ -249,7 +249,7 @@ func (ctx *context) emitCall(w *bytes.Buffer, call prog.ExecCall, ci int, haveCo } fmt.Fprintf(w, ");") comment := ctx.target.AnnotateCall(call) - if len(comment) != 0 { + if comment != "" { fmt.Fprintf(w, " /* %s */", comment) } fmt.Fprintf(w, "\n") diff --git a/pkg/host/syscalls_linux.go b/pkg/host/syscalls_linux.go index 8481d7749..3f16d9ba0 100644 --- a/pkg/host/syscalls_linux.go +++ b/pkg/host/syscalls_linux.go @@ -352,7 +352,7 @@ func isSupportedOpenAt(c *prog.Syscall) (bool, string) { var err error fname, ok := extractStringConst(c.Args[1].Type) - if !ok || len(fname) == 0 || fname[0] != '/' { + if !ok || fname == "" || fname[0] != '/' { return true, "" } @@ -415,7 +415,7 @@ func extractStringConst(typ prog.Type) (string, bool) { return "", false } v := str.Values[0] - for len(v) != 0 && v[len(v)-1] == 0 { + for v != "" && v[len(v)-1] == 0 { v = v[:len(v)-1] // string terminating \x00 } return v, true diff --git a/prog/rand.go b/prog/rand.go index a6c013fdd..5ff448062 100644 --- a/prog/rand.go +++ b/prog/rand.go @@ -249,7 +249,7 @@ func (r *randGen) flags(vv []uint64, bitmask bool, oldVal uint64) uint64 { func (r *randGen) filename(s *state, typ *BufferType) string { fn := r.filenameImpl(s) - if len(fn) != 0 && fn[len(fn)-1] == 0 { + if fn != "" && fn[len(fn)-1] == 0 { panic(fmt.Sprintf("zero-terminated filename: %q", fn)) } if escapingFilename(fn) { @@ -284,7 +284,7 @@ func (r *randGen) filenameImpl(s *state) string { dir := "." if r.oneOf(2) && len(s.files) != 0 { dir = r.randFromMap(s.files) - if len(dir) > 0 && dir[len(dir)-1] == 0 { + if dir != "" && dir[len(dir)-1] == 0 { dir = dir[:len(dir)-1] } if r.oneOf(10) && filepath.Clean(dir)[0] != '.' { diff --git a/syz-manager/manager.go b/syz-manager/manager.go index 7c275e280..84a5998fe 100644 --- a/syz-manager/manager.go +++ b/syz-manager/manager.go @@ -689,7 +689,7 @@ func (mgr *Manager) saveCrash(crash *Crash) bool { } } osutil.WriteFile(filepath.Join(dir, fmt.Sprintf("log%v", oldestI)), crash.Output) - if len(mgr.cfg.Tag) > 0 { + if mgr.cfg.Tag != "" { osutil.WriteFile(filepath.Join(dir, fmt.Sprintf("tag%v", oldestI)), []byte(mgr.cfg.Tag)) } if len(crash.Report.Report) > 0 { @@ -836,7 +836,7 @@ func (mgr *Manager) saveRepro(res *repro.Result, stats *repro.Stats, hub bool) { log.Logf(0, "failed to write crash: %v", err) } osutil.WriteFile(filepath.Join(dir, "repro.prog"), append([]byte(opts), prog...)) - if len(mgr.cfg.Tag) > 0 { + if mgr.cfg.Tag != "" { osutil.WriteFile(filepath.Join(dir, "repro.tag"), []byte(mgr.cfg.Tag)) } if len(rep.Output) > 0 { |
