mirror of
https://github.com/reactos/syzkaller.git
synced 2025-02-09 05:16:08 +00:00
all: fix some static analysis warnings
Fix warnings produced by golangci-lint. Update #977
This commit is contained in:
parent
2398edeacc
commit
8095117313
@ -174,8 +174,6 @@ func checkTestJob(c context.Context, bug *Bug, bugReporting *BugReporting, crash
|
||||
return fmt.Sprintf("%q does not look like a valid git repo address.", repo)
|
||||
case !vcs.CheckBranch(branch) && !vcs.CheckCommitHash(branch):
|
||||
return fmt.Sprintf("%q does not look like a valid git branch or commit.", branch)
|
||||
case crash.ReproC == 0 && crash.ReproSyz == 0:
|
||||
return "This crash does not have a reproducer. I cannot test it."
|
||||
case bug.Status == BugStatusFixed:
|
||||
return "This bug is already marked as fixed. No point in testing."
|
||||
case bug.Status == BugStatusInvalid:
|
||||
|
@ -56,45 +56,45 @@ func (opts Options) Check(OS string) error {
|
||||
}
|
||||
if !opts.Threaded && opts.Collide {
|
||||
// Collide requires threaded.
|
||||
return errors.New("Collide without Threaded")
|
||||
return errors.New("option Collide without Threaded")
|
||||
}
|
||||
if !opts.Repeat {
|
||||
if opts.Procs > 1 {
|
||||
// This does not affect generated code.
|
||||
return errors.New("Procs>1 without Repeat")
|
||||
return errors.New("option Procs>1 without Repeat")
|
||||
}
|
||||
if opts.EnableNetReset {
|
||||
return errors.New("EnableNetReset without Repeat")
|
||||
return errors.New("option EnableNetReset without Repeat")
|
||||
}
|
||||
if opts.RepeatTimes > 1 {
|
||||
return errors.New("RepeatTimes without Repeat")
|
||||
return errors.New("option RepeatTimes without Repeat")
|
||||
}
|
||||
}
|
||||
if opts.Sandbox == "" {
|
||||
if opts.EnableTun {
|
||||
return errors.New("EnableTun without sandbox")
|
||||
return errors.New("option EnableTun without sandbox")
|
||||
}
|
||||
if opts.EnableNetDev {
|
||||
return errors.New("EnableNetDev without sandbox")
|
||||
return errors.New("option EnableNetDev without sandbox")
|
||||
}
|
||||
if opts.EnableCgroups {
|
||||
return errors.New("EnableCgroups without sandbox")
|
||||
return errors.New("option EnableCgroups without sandbox")
|
||||
}
|
||||
if opts.EnableBinfmtMisc {
|
||||
return errors.New("EnableBinfmtMisc without sandbox")
|
||||
return errors.New("option EnableBinfmtMisc without sandbox")
|
||||
}
|
||||
}
|
||||
if opts.Sandbox == sandboxNamespace && !opts.UseTmpDir {
|
||||
// This is borken and never worked.
|
||||
// This tries to create syz-tmp dir in cwd,
|
||||
// which will fail if procs>1 and on second run of the program.
|
||||
return errors.New("Sandbox=namespace without UseTmpDir")
|
||||
return errors.New("option Sandbox=namespace without UseTmpDir")
|
||||
}
|
||||
if opts.EnableNetReset && (opts.Sandbox == "" || opts.Sandbox == sandboxSetuid) {
|
||||
return errors.New("EnableNetReset without sandbox")
|
||||
return errors.New("option EnableNetReset without sandbox")
|
||||
}
|
||||
if opts.EnableCgroups && !opts.UseTmpDir {
|
||||
return errors.New("EnableCgroups without UseTmpDir")
|
||||
return errors.New("option EnableCgroups without UseTmpDir")
|
||||
}
|
||||
return opts.checkLinuxOnly(OS)
|
||||
}
|
||||
@ -104,19 +104,19 @@ func (opts Options) checkLinuxOnly(OS string) error {
|
||||
return nil
|
||||
}
|
||||
if opts.EnableTun && !(OS == openbsd || OS == freebsd) {
|
||||
return fmt.Errorf("EnableTun is not supported on %v", OS)
|
||||
return fmt.Errorf("option EnableTun is not supported on %v", OS)
|
||||
}
|
||||
if opts.EnableNetDev {
|
||||
return fmt.Errorf("EnableNetDev is not supported on %v", OS)
|
||||
return fmt.Errorf("option EnableNetDev is not supported on %v", OS)
|
||||
}
|
||||
if opts.EnableNetReset {
|
||||
return fmt.Errorf("EnableNetReset is not supported on %v", OS)
|
||||
return fmt.Errorf("option EnableNetReset is not supported on %v", OS)
|
||||
}
|
||||
if opts.EnableCgroups {
|
||||
return fmt.Errorf("EnableCgroups is not supported on %v", OS)
|
||||
return fmt.Errorf("option EnableCgroups is not supported on %v", OS)
|
||||
}
|
||||
if opts.EnableBinfmtMisc {
|
||||
return fmt.Errorf("EnableBinfmtMisc is not supported on %v", OS)
|
||||
return fmt.Errorf("option EnableBinfmtMisc is not supported on %v", OS)
|
||||
}
|
||||
if opts.EnableCloseFds {
|
||||
return fmt.Errorf("EnableCloseFds is not supported on %v", OS)
|
||||
@ -124,10 +124,10 @@ func (opts Options) checkLinuxOnly(OS string) error {
|
||||
if opts.Sandbox == sandboxNamespace ||
|
||||
(opts.Sandbox == sandboxSetuid && !(OS == openbsd || OS == freebsd)) ||
|
||||
opts.Sandbox == sandboxAndroidUntrustedApp {
|
||||
return fmt.Errorf("Sandbox=%v is not supported on %v", opts.Sandbox, OS)
|
||||
return fmt.Errorf("option Sandbox=%v is not supported on %v", opts.Sandbox, OS)
|
||||
}
|
||||
if opts.Fault {
|
||||
return fmt.Errorf("Fault is not supported on %v", OS)
|
||||
return fmt.Errorf("option Fault is not supported on %v", OS)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -430,7 +430,6 @@ func parsePattern(insn *ifuzz.Insn, vals []string) error {
|
||||
v == "NELEM_QUARTERMEM()",
|
||||
v == "NELEM_EIGHTHMEM()",
|
||||
v == "NELEM_HALFMEM()",
|
||||
v == "NELEM_QUARTERMEM()",
|
||||
v == "NELEM_MEM128()",
|
||||
v == "NELEM_SCALAR()",
|
||||
v == "NELEM_TUPLE1()",
|
||||
|
@ -110,6 +110,9 @@ func (dec *execDecoder) parse() {
|
||||
Addr: dec.read(),
|
||||
Size: dec.read(),
|
||||
})
|
||||
case execInstrEOF:
|
||||
dec.commitCall()
|
||||
return
|
||||
default:
|
||||
dec.commitCall()
|
||||
if instr >= uint64(len(dec.target.Syscalls)) {
|
||||
@ -127,9 +130,6 @@ func (dec *execDecoder) parse() {
|
||||
return
|
||||
}
|
||||
}
|
||||
case execInstrEOF:
|
||||
dec.commitCall()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ mutate7()
|
||||
mutate8()
|
||||
`,
|
||||
} {
|
||||
t.Logf("test #%v: %q", i, string(data))
|
||||
t.Logf("test #%v: %q", i, data)
|
||||
FuzzDeserialize([]byte(data))
|
||||
FuzzParseLog([]byte(data))
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ func (merger *OutputMerger) AddDecoder(name string, r io.ReadCloser,
|
||||
}
|
||||
select {
|
||||
case merger.Output <- append([]byte{}, out...):
|
||||
r := copy(pending[:], pending[pos+1:])
|
||||
r := copy(pending, pending[pos+1:])
|
||||
pending = pending[:r]
|
||||
default:
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user