aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-07-11 17:09:04 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-07-12 08:22:44 +0200
commitc1147c8df73eb61bc9d66e6628e0369e21f28670 (patch)
tree1f5f75bf13a32941025c134fdd236fb137cf3181 /pkg
parent0faffd0438df859fb66236085ac3992735900d26 (diff)
all: fix comments format
Fix capitalization, dots at the end and two spaces after a period. Update #1876
Diffstat (limited to 'pkg')
-rw-r--r--pkg/build/netbsd.go10
-rw-r--r--pkg/compiler/types.go4
-rw-r--r--pkg/csource/csource.go12
-rw-r--r--pkg/host/syscalls_linux.go2
-rw-r--r--pkg/host/syscalls_linux_test.go2
-rw-r--r--pkg/ifuzz/gen/gen.go2
-rw-r--r--pkg/ifuzz/ifuzz.go16
-rw-r--r--pkg/ifuzz/pseudo.go14
-rw-r--r--pkg/ipc/ipc.go3
-rw-r--r--pkg/report/fuchsia.go2
-rw-r--r--pkg/report/linux.go2
-rw-r--r--pkg/report/report.go2
-rw-r--r--pkg/vcs/fuchsia.go2
-rw-r--r--pkg/vcs/linux_test.go6
14 files changed, 40 insertions, 39 deletions
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, "<lambda(") {
- // demangle produces super long (full) names for lambdas.
+ // Demangling produces super long (full) names for lambdas.
name = "lambda"
}
id := "[ inline ]"
diff --git a/pkg/report/linux.go b/pkg/report/linux.go
index cbc839cc0..c453a9180 100644
--- a/pkg/report/linux.go
+++ b/pkg/report/linux.go
@@ -318,7 +318,7 @@ func (ctx *linux) stripLinePrefix(line []byte, context string, useQuestionable b
pos := bytes.Index(line, []byte(" ? "))
return line[pos+2:], !useQuestionable
}
- // powerpc suffix.
+ // PowerPC suffix.
if bytes.HasSuffix(line, []byte(" (unreliable)")) {
return line[:len(line)-13], !useQuestionable
}
diff --git a/pkg/report/report.go b/pkg/report/report.go
index af2ee782d..b1b695887 100644
--- a/pkg/report/report.go
+++ b/pkg/report/report.go
@@ -263,7 +263,7 @@ var dynamicTitleReplacement = []replacement{
"syz-executor",
},
{
- // syzkaller binaries are coming from repro.
+ // Executor process IDs are dynamic and are not interesting.
regexp.MustCompile(`syzkaller[0-9]+((/|:)[0-9]+)?`),
"syzkaller",
},
diff --git a/pkg/vcs/fuchsia.go b/pkg/vcs/fuchsia.go
index e00b31098..9b052e0de 100644
--- a/pkg/vcs/fuchsia.go
+++ b/pkg/vcs/fuchsia.go
@@ -27,7 +27,7 @@ func newFuchsia(vm, dir string) *fuchsia {
func (ctx *fuchsia) Poll(repo, branch string) (*Commit, error) {
if repo != "https://fuchsia.googlesource.com" || branch != "master" {
- // fuchsia ecosystem is hard-tailored to the main repo.
+ // Fuchsia ecosystem is hard-wired to the main repo.
return nil, fmt.Errorf("fuchsia: can only check out https://fuchsia.googlesource.com/master")
}
if _, err := runSandboxed(ctx.dir, "./.jiri_root/bin/jiri", "update"); err != nil {
diff --git a/pkg/vcs/linux_test.go b/pkg/vcs/linux_test.go
index bacf89edb..c2bfd17e0 100644
--- a/pkg/vcs/linux_test.go
+++ b/pkg/vcs/linux_test.go
@@ -18,9 +18,9 @@ import (
type MinimizationTest struct {
config string
baselineConfig string
- // Output contains expected config option
+ // Output contains expected config option.
expectedConfig string
- // Minimization is expected to pass or fail
+ // Minimization is expected to pass or fail.
passing bool
}
@@ -104,7 +104,7 @@ func createTestLinuxRepo(t *testing.T) string {
t.Fatal(err)
}
- // Copy stubbed scripts used by config bisect
+ // Copy stubbed scripts used by config bisect.
err = osutil.CopyFile("testdata/linux/config-bisect.pl",
baseDir+"/tools/testing/ktest/config-bisect.pl")
if err != nil {