From a316ebdbff3a501a1b041a488b2f22c8783df5f8 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 24 Oct 2024 14:21:08 +0200 Subject: tools/syz-declextract: fix error handling Fix the following bugs: if fErr != nil { tool.Fail(err) } --- tools/syz-declextract/run.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/syz-declextract/run.go b/tools/syz-declextract/run.go index 36f1762d4..a680ea12c 100644 --- a/tools/syz-declextract/run.go +++ b/tools/syz-declextract/run.go @@ -303,18 +303,21 @@ func readSyscallNames(kernelDir string) map[string][]string { for _, arch := range targets.List[targets.Linux] { filepath.Walk(filepath.Join(kernelDir, arch.KernelHeaderArch), func(path string, info fs.FileInfo, err error) error { + if err != nil { + return err + } if !strings.HasSuffix(path, ".tbl") { return nil } - fi, fErr := os.Lstat(path) - if fErr != nil { + fi, err := os.Lstat(path) + if err != nil { tool.Fail(err) } if fi.Mode()&fs.ModeSymlink != 0 { // Some symlinks link to files outside of arch directory. return nil } - f, fErr := os.Open(path) - if fErr != nil { + f, err := os.Open(path) + if err != nil { tool.Fail(err) } s := bufio.NewScanner(f) -- cgit mrf-deployment