From c1147c8df73eb61bc9d66e6628e0369e21f28670 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 11 Jul 2020 17:09:04 +0200 Subject: all: fix comments format Fix capitalization, dots at the end and two spaces after a period. Update #1876 --- pkg/build/netbsd.go | 10 +++++----- pkg/compiler/types.go | 4 ++-- pkg/csource/csource.go | 12 ++++++------ pkg/host/syscalls_linux.go | 2 +- pkg/host/syscalls_linux_test.go | 2 +- pkg/ifuzz/gen/gen.go | 2 +- pkg/ifuzz/ifuzz.go | 16 ++++++++-------- pkg/ifuzz/pseudo.go | 14 +++++++------- pkg/ipc/ipc.go | 3 ++- pkg/report/fuchsia.go | 2 +- pkg/report/linux.go | 2 +- pkg/report/report.go | 2 +- pkg/vcs/fuchsia.go | 2 +- pkg/vcs/linux_test.go | 6 +++--- 14 files changed, 40 insertions(+), 39 deletions(-) (limited to 'pkg') diff --git a/pkg/build/netbsd.go b/pkg/build/netbsd.go index ecf21ee77..43620c9cf 100644 --- a/pkg/build/netbsd.go +++ b/pkg/build/netbsd.go @@ -30,25 +30,25 @@ func (ctx netbsd) build(params *Params) error { return err } - // Clear the tools + // Clear the tools. if _, err := osutil.RunCmd(5*time.Minute, params.KernelDir, "rm", "-rf", "obj/"); err != nil { return err } - // Clear the build files + // Clear the build files. if _, err := osutil.RunCmd(5*time.Minute, params.KernelDir, "rm", "-rf", compileDir); err != nil { return err } if strings.HasSuffix(params.Compiler, "clang++") { - // Build tools before building kernel + // Build tools before building kernel. if _, err := osutil.RunCmd(60*time.Minute, params.KernelDir, "./build.sh", "-m", params.TargetArch, "-U", "-j"+strconv.Itoa(runtime.NumCPU()), "-V", "MKCTF=no", "-V", "MKLLVM=yes", "-V", "MKGCC=no", "-V", "HAVE_LLVM=yes", "tools"); err != nil { return err } - // Build kernel + // Build kernel. if _, err := osutil.RunCmd(20*time.Minute, params.KernelDir, "./build.sh", "-m", params.TargetArch, "-U", "-j"+strconv.Itoa(runtime.NumCPU()), "-V", "MKCTF=no", "-V", "MKLLVM=yes", "-V", "MKGCC=no", "-V", "HAVE_LLVM=yes", "kernel="+kernelName); err != nil { @@ -126,7 +126,7 @@ func (ctx netbsd) copyKernelToDisk(targetArch, vmType, outputDir, kernel string) return fmt.Errorf("failed to create the VM Instance: %v", err) } defer inst.Close() - // Copy the kernel into the disk image and replace it + // Copy the kernel into the disk image and replace it. kernel, err = inst.Copy(kernel) if err != nil { return fmt.Errorf("error copying the kernel: %v", err) diff --git a/pkg/compiler/types.go b/pkg/compiler/types.go index fd021cefc..6cf32e39f 100644 --- a/pkg/compiler/types.go +++ b/pkg/compiler/types.go @@ -107,9 +107,9 @@ var typeInt = &typeDesc{ comp.error(args[0].Pos, "bad int range [%v:%v]", begin, end) return } - // range is in [0:MAX_UINT] + // The range fits into the size if treated as unsigned [0:MAX_UINT]. inUnsignedBase := begin <= maxUInt && end <= maxUInt - // range is in [-MIN_SINT:MAX_SINT] + // The range fits into the size if treated as signed [-MIN_SINT:MAX_SINT]. inSignedBase := begin+maxSInt <= maxUInt && end+maxSInt <= maxUInt if size < 64 && !inUnsignedBase && !inSignedBase { comp.error(args[0].Colon[0].Pos, "int range [%v:%v] is too large for base type of size %v", diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go index 2eda7c76d..e679468df 100644 --- a/pkg/csource/csource.go +++ b/pkg/csource/csource.go @@ -407,18 +407,18 @@ func (ctx *context) constArgToStr(arg prog.ExecArgConst, handleBigEndian, native } if native && arg.Size == 8 { // syscall() is variadic, so constant arguments must be explicitly - // promoted. Otherwise the compiler is free to leave garbage in the - // upper 32 bits of the argument value. In practice this can happen + // promoted. Otherwise the compiler is free to leave garbage in the + // upper 32 bits of the argument value. In practice this can happen // on amd64 with arguments that are passed on the stack, i.e., - // arguments beyond the first six. For example, on freebsd/amd64, + // arguments beyond the first six. For example, on freebsd/amd64, // syscall(SYS_mmap, ..., 0) causes clang to emit a 32-bit store of // 0 to the stack, but the kernel expects a 64-bit value. // // syzkaller's argument type representations do not always match - // the OS ABI. For instance, "flags" is always 64 bits wide on 64-bit + // the OS ABI. For instance, "flags" is always 64 bits wide on 64-bit // platforms, but is a 32-bit value ("unsigned int" or so) in many - // cases. Thus, we assume here that passing a 64-bit argument where - // a 32-bit argument is expected won't break anything. On amd64 + // cases. Thus, we assume here that passing a 64-bit argument where + // a 32-bit argument is expected won't break anything. On amd64 // this should be fine: arguments are passed in 64-bit registers or // at 64 bit-aligned addresses on the stack. if ctx.target.PtrSize == 4 { diff --git a/pkg/host/syscalls_linux.go b/pkg/host/syscalls_linux.go index 3f16d9ba0..18dc81d9e 100644 --- a/pkg/host/syscalls_linux.go +++ b/pkg/host/syscalls_linux.go @@ -358,7 +358,7 @@ func isSupportedOpenAt(c *prog.Syscall) (bool, string) { modes := []int{syscall.O_RDONLY, syscall.O_WRONLY, syscall.O_RDWR} - // Attempt to extract flags from the syscall description + // Attempt to extract flags from the syscall description. if mode, ok := c.Args[2].Type.(*prog.ConstType); ok { modes = []int{int(mode.Val)} } diff --git a/pkg/host/syscalls_linux_test.go b/pkg/host/syscalls_linux_test.go index 8e9feeba2..3ce2e3517 100644 --- a/pkg/host/syscalls_linux_test.go +++ b/pkg/host/syscalls_linux_test.go @@ -116,7 +116,7 @@ c037c7f8 T sys_getppid []string{"setfsgid", "getpid", "gettid", "getppid"}, []string{"setfsgid", "getpid", "gettid", "getppid"}, }, - // Test kallsymsRenameMap + // Test kallsymsRenameMap. { "ppc64le", []byte(` diff --git a/pkg/ifuzz/gen/gen.go b/pkg/ifuzz/gen/gen.go index 224010a1c..2bbd69109 100644 --- a/pkg/ifuzz/gen/gen.go +++ b/pkg/ifuzz/gen/gen.go @@ -343,7 +343,7 @@ func parsePattern(insn *ifuzz.Insn, vals []string) error { case v == "SE_IMM8()": addImm(insn, 1) - // Modes + // Modes. case v == "mode64": insn.Mode &= 1 << ifuzz.ModeLong64 case v == "not64": diff --git a/pkg/ifuzz/ifuzz.go b/pkg/ifuzz/ifuzz.go index 2d51e0340..5d6269926 100644 --- a/pkg/ifuzz/ifuzz.go +++ b/pkg/ifuzz/ifuzz.go @@ -140,37 +140,37 @@ func Mutate(cfg *Config, r *rand.Rand, text []byte) []byte { retry = false switch x := r.Intn(100); { case x < 10 && len(insns) != 0: - // delete instruction + // Delete instruction. i := r.Intn(len(insns)) copy(insns[i:], insns[i+1:]) insns = insns[:len(insns)-1] case x < 40 && len(insns) != 0: - // replace instruction with another + // Replace instruction with another. insn := randInsn(cfg, r) text1 := insn.Encode(cfg, r) i := r.Intn(len(insns)) insns[i] = text1 case x < 70 && len(insns) != 0: - // mutate instruction + // Mutate instruction. i := r.Intn(len(insns)) text1 := insns[i] for stop := false; !stop || len(text1) == 0; stop = r.Intn(2) == 0 { switch x := r.Intn(100); { case x < 5 && len(text1) != 0: - // delete byte + // Delete byte. pos := r.Intn(len(text1)) copy(text1[pos:], text1[pos+1:]) text1 = text1[:len(text1)-1] case x < 40 && len(text1) != 0: - // replace a byte + // Replace a byte. pos := r.Intn(len(text1)) text1[pos] = byte(r.Intn(256)) case x < 70 && len(text1) != 0: - // flip a bit + // Flip a bit. pos := r.Intn(len(text1)) text1[pos] ^= 1 << byte(r.Intn(8)) default: - // insert a byte + // Insert a byte. pos := r.Intn(len(text1) + 1) text1 = append(text1, 0) copy(text1[pos+1:], text1[pos:]) @@ -179,7 +179,7 @@ func Mutate(cfg *Config, r *rand.Rand, text []byte) []byte { } insns[i] = text1 case len(insns) < cfg.Len: - // insert a new instruction + // Insert a new instruction. insn := randInsn(cfg, r) text1 := insn.Encode(cfg, r) i := r.Intn(len(insns) + 1) diff --git a/pkg/ifuzz/pseudo.go b/pkg/ifuzz/pseudo.go index 306725d2e..e9903f909 100644 --- a/pkg/ifuzz/pseudo.go +++ b/pkg/ifuzz/pseudo.go @@ -162,7 +162,7 @@ func initPseudo() { } reg := uint8(r.Intn(6)) gen.mov16(regAX, sel) - gen.byte(0x8e, 0xc0|(reg<<3)) // mov %ax, %seg + gen.byte(0x8e, 0xc0|(reg<<3)) // MOV %ax, %seg return gen.text }, }) @@ -421,10 +421,10 @@ func (gen *generator) xor32(reg int, v uint32) { func (gen *generator) readCR(cr uint8) { if cr < 8 { - // mov %crN, %eax/%rax + // MOV %crN, %eax/%rax gen.byte(0x0f, 0x20, 0xc0|cr<<3) } else if cr < 16 { - // mov %crN, %eax/%rax + // MOV %crN, %eax/%rax gen.byte(0x44, 0x0f, 0x20, 0xc0|(cr-8)<<3) } else { panic("bad cr") @@ -433,10 +433,10 @@ func (gen *generator) readCR(cr uint8) { func (gen *generator) writeCR(cr uint8) { if cr < 8 { - // mov %eax/%rax, %crN + // MOV %eax/%rax, %crN gen.byte(0x0f, 0x22, 0xc0|cr<<3) } else if cr < 16 { - // mov %eax/%rax, %crN + // MOV %eax/%rax, %crN gen.byte(0x44, 0x0f, 0x22, 0xc0|(cr-8)<<3) } else { panic("bad cr") @@ -447,7 +447,7 @@ func (gen *generator) readDR(dr uint8) { if dr >= 8 { panic("bad dr") } - // mov %drN, %eax/%rax + // MOV %drN, %eax/%rax gen.byte(0x0f, 0x21, 0xc0|dr<<3) } @@ -455,7 +455,7 @@ func (gen *generator) writeDR(dr uint8) { if dr >= 8 { panic("bad dr") } - // mov %eax/%rax, %drN + // MOV %eax/%rax, %drN gen.byte(0x0f, 0x23, 0xc0|dr<<3) } diff --git a/pkg/ipc/ipc.go b/pkg/ipc/ipc.go index 1abab7f5e..4e41f92fe 100644 --- a/pkg/ipc/ipc.go +++ b/pkg/ipc/ipc.go @@ -507,7 +507,8 @@ type executeReq struct { faultCall uint64 faultNth uint64 progSize uint64 - // prog follows on pipe or in shmem + // This structure is followed by a serialized test program in encodingexec format. + // Both when sent over a pipe or in shared memory. } type executeReply struct { diff --git a/pkg/report/fuchsia.go b/pkg/report/fuchsia.go index e6df94eac..e83d6fadf 100644 --- a/pkg/report/fuchsia.go +++ b/pkg/report/fuchsia.go @@ -139,7 +139,7 @@ func (ctx *fuchsia) processPC(out *bytes.Buffer, symb *symbolizer.Symbolizer, file := ctx.trimFile(frame.File) name := demangle.Filter(frame.Func, demangle.NoParams, demangle.NoTemplateParams) if strings.Contains(name, "